From 5bfaaea1c2aee4bb8ebc79f83c1cd0b32addd2ee Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Thu, 7 Dec 2017 13:43:37 -0500 Subject: [PATCH] feat: configuration option to silence error messages (#13) * Add a configuration option to silence error messages * Move reconnect logic outside of silent condition --- package.json | 5 +++++ src/extension.ts | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d195dcf..58a4db4 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,11 @@ "type": "string", "default": "{appname}", "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" } } } diff --git a/src/extension.ts b/src/extension.ts index 6098a39..be9be0f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -124,8 +124,10 @@ function initRPC(clientID: string): void { if (reconnectCounter >= config.get('reconnectThreshold')) destroyRPC(); else return; } - if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!'); - else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`); + if(!config.get('silent')) { + if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!'); + else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`); + } }); }