mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 20:20:55 +00: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:
parent
b8c11f0bed
commit
dd31ee0c5f
1 changed files with 2 additions and 2 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue