mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +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() {
|
destroy() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.client.ws.destroy();
|
this.client.ws.destroy();
|
||||||
if (!this.client.user.bot) {
|
if (!this.client.user.bot) {
|
||||||
this.client.rest.methods.logout().then(resolve);
|
this.client.rest.methods.logout().then(resolve, reject);
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user