3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 02:57:20 +00:00

fix: fix error handling in InternalPoster.sendMessage direct sends

This commit is contained in:
Dragory 2021-11-02 21:40:24 +02:00
parent 4179bc4ee1
commit fe63ec9d77
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 21 additions and 13 deletions

View file

@ -29,10 +29,14 @@ export class Queue<TQueueFunction extends AnyFn = AnyFn> {
}
public add(fn: TQueueFunction): Promise<any> {
const promise = new Promise<any>((resolve) => {
const promise = new Promise<any>((resolve, reject) => {
this.queue.push(async () => {
const result = await fn();
resolve(result);
try {
const result = await fn();
resolve(result);
} catch (err) {
reject(err);
}
});
if (!this.running) this.next();