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:
parent
7bc76fd0d6
commit
5bfaaea1c2
2 changed files with 9 additions and 2 deletions
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(!config.get('silent')) {
|
||||||
if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!');
|
if (error.message.includes('ENOENT')) window.showErrorMessage('No Discord Client detected!');
|
||||||
else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`);
|
else window.showErrorMessage(`Couldn't connect to discord via rpc: ${error.message}`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue