UNPKG

864 BJavaScriptView Raw
1'use strict';
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.KuzzleError = void 0;
4/**
5 * Standard Kuzzle error.
6 *
7 * @see https://docs.kuzzle.io/core/2/api/errors/types/
8 */
9class 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 // PartialError
24 if (this.status === 206) {
25 this.errors = apiError.errors;
26 this.count = apiError.count;
27 }
28 }
29}
30exports.KuzzleError = KuzzleError;
31//# sourceMappingURL=KuzzleError.js.map
\No newline at end of file