File size: 561 Bytes
8a37e0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * A custom error class for queue event errors. These errors have a type, message and traceback.
 */

export class QueueError extends Error {
  type: string;
  traceback: string;

  constructor(type: string, message: string, traceback: string) {
    super(message);
    this.name = 'QueueError';
    this.type = type;
    this.traceback = traceback;

    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, QueueError);
    }
  }

  toString() {
    return `${this.name} [${this.type}]: ${this.message}\nTraceback:\n${this.traceback}`;
  }
}