support maximum request body size
[squeep-api-dingus] / lib / errors.js
1 'use strict';
2
3 class DingusError extends Error {
4 constructor(...args) {
5 super(...args);
6 Error.captureStackTrace(DingusError);
7 }
8
9 get name() {
10 return this.constructor.name;
11 }
12 }
13
14 class ResponseError extends DingusError {
15 constructor(errorResponse, details) {
16 super(errorResponse.errorMessage);
17 Object.assign(this, {
18 ...errorResponse,
19 ...(details && { details }),
20 });
21 delete this.stack; // No need for stacktrace here.
22 }
23 }
24
25 module.exports = {
26 DingusError,
27 ResponseError,
28 };