1 | 'use strict';
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.KuzzleError = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | class KuzzleError extends Error {
|
10 | constructor(apiError, stack = null) {
|
11 | super(apiError.message);
|
12 | this.status = apiError.status;
|
13 | if (apiError.stack) {
|
14 | Reflect.defineProperty(this, 'kuzzleStack', {
|
15 | value: apiError.stack
|
16 | });
|
17 | }
|
18 | if (stack) {
|
19 | this.stack = stack;
|
20 | }
|
21 | this.id = apiError.id;
|
22 | this.code = apiError.code;
|
23 |
|
24 | if (this.status === 206) {
|
25 | this.errors = apiError.errors;
|
26 | this.count = apiError.count;
|
27 | }
|
28 | }
|
29 | }
|
30 | exports.KuzzleError = KuzzleError;
|
31 |
|
\ | No newline at end of file |