discord-rich-presence icon indicating copy to clipboard operation
discord-rich-presence copied to clipboard

Closing Discord, unhandled promise rejection

Open xL0b0 opened this issue 4 years ago • 3 comments

If closing Discord, this ends up in an unhandled promise rejection. Could this please be changed so it could be handled, in order to retry initializing it after it was closed?

xL0b0 avatar Feb 20 '21 17:02 xL0b0

Try listening for the error event like this:

const client = require('discord-rich-presence')('180984871685062656');

client.on('error', err => {
    console.log(`Error: ${err}`);
});

Sv443 avatar Mar 29 '21 12:03 Sv443

Try listening for the error event like this:

const client = require('discord-rich-presence')('180984871685062656');

client.on('error', err => {
    console.log(`Error: ${err}`);
});

We can't handle error with this. The code stop running after that

ozaik avatar Oct 27 '21 11:10 ozaik

This can only account for errors in the init. Otherwise you will still get

(node:16829) UnhandledPromiseRejectionWarning: Error: connection closed

if you close Discord while running.

xL0b0 avatar Oct 27 '21 11:10 xL0b0