feat: configuration option to silence error messages (#13)

* Add a configuration option to silence error messages

* Move reconnect logic outside of silent condition
This commit is contained in:
Charles Milette 2017-12-07 13:43:37 -05:00 committed by Crawl
parent 7bc76fd0d6
commit 5bfaaea1c2
2 changed files with 9 additions and 2 deletions

View file

@ -103,6 +103,11 @@
"type": "string", "type": "string",
"default": "{appname}", "default": "{appname}",
"description": "Custom string for the smallImageText section of the rich presence" "description": "Custom string for the smallImageText section of the rich presence"
},
"discord.silent": {
"type": "boolean",
"default": false,
"description": "Decides if error messages are shown to the user"
} }
} }
} }

View file

@ -124,8 +124,10 @@ function initRPC(clientID: string): void {
if (reconnectCounter >= config.get('reconnectThreshold')) destroyRPC(); if (reconnectCounter >= config.get('reconnectThreshold')) destroyRPC();
else return; else return;
} }
if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!'); if(!config.get('silent')) {
else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`); if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!');
else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`);
}
}); });
} }