mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
propagate errors in ClientManager.destroy (#844)
If the promise returned by logout() rejects, previously it would be completely uncaught, and just return an eternally pending promise that never resolved. Related to pull requests #828 and #839.
This commit is contained in:
@@ -58,10 +58,10 @@ class ClientManager {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client.ws.destroy();
|
||||
if (!this.client.user.bot) {
|
||||
this.client.rest.methods.logout().then(resolve);
|
||||
this.client.rest.methods.logout().then(resolve, reject);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user