From a3a2e47f58aa0a5a82867a66ea9bb70a08794419 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Fri, 24 Nov 2017 03:31:37 +0100 Subject: [PATCH] fix: don't throw errors if a reconnect is ongoing --- src/extension.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 04e4ad1..025c271 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -81,11 +81,11 @@ function initRPC(clientID: string): void { }); // Log in to the RPC Client, and check whether or not it errors. - rpc.login(clientID).catch(error => - error.message.includes('ENOENT') - ? window.showErrorMessage('No Discord Client detected!') - : window.showErrorMessage(`Could not connect to discord via rpc: ${error.message}`) - ); + rpc.login(clientID).catch(error => { + if (reconnect) return; + if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!'); + else window.showErrorMessage(`Could not connect to discord via rpc: ${error.message}`); + }); } // Cleanly destroy the RPC client (if it isn't already).