1 | ;
|
2 | /**
|
3 | * -------------------------------------------------------------------------------------------
|
4 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
5 | * See License in the project root for license information.
|
6 | * -------------------------------------------------------------------------------------------
|
7 | */
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | exports.GraphError = void 0;
|
10 | var tslib_1 = require("tslib");
|
11 | /**
|
12 | * @module GraphError
|
13 | */
|
14 | /**
|
15 | * @class
|
16 | * Class for GraphError
|
17 | * @NOTE: This is NOT what is returned from the Graph
|
18 | * GraphError is created from parsing JSON errors returned from the graph
|
19 | * Some fields are renamed ie, "request-id" => requestId so you can use dot notation
|
20 | */
|
21 | var GraphError = /** @class */ (function (_super) {
|
22 | tslib_1.__extends(GraphError, _super);
|
23 | /**
|
24 | * @public
|
25 | * @constructor
|
26 | * Creates an instance of GraphError
|
27 | * @param {number} [statusCode = -1] - The status code of the error
|
28 | * @param {string} [message] - The message of the error
|
29 | * @param {Error} [baseError] - The base error
|
30 | * @returns An instance of GraphError
|
31 | */
|
32 | function GraphError(statusCode, message, baseError) {
|
33 | if (statusCode === void 0) { statusCode = -1; }
|
34 | var _this = _super.call(this, message || (baseError && baseError.message)) || this;
|
35 | // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
36 | Object.setPrototypeOf(_this, GraphError.prototype);
|
37 | _this.statusCode = statusCode;
|
38 | _this.code = null;
|
39 | _this.requestId = null;
|
40 | _this.date = new Date();
|
41 | _this.body = null;
|
42 | _this.stack = baseError ? baseError.stack : _this.stack;
|
43 | return _this;
|
44 | }
|
45 | return GraphError;
|
46 | }(Error));
|
47 | exports.GraphError = GraphError;
|
48 | //# sourceMappingURL=GraphError.js.map |
\ | No newline at end of file |