fix: fix error handling in InternalPoster.sendMessage direct sends
This commit is contained in:
parent
4179bc4ee1
commit
fe63ec9d77
3 changed files with 21 additions and 13 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue