UNPKG

1.88 kBJavaScriptView Raw
1"use strict";
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 */
8Object.defineProperty(exports, "__esModule", { value: true });
9exports.GraphError = void 0;
10var 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 */
21var 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 * @returns An instance of GraphError
29 */
30 function GraphError(statusCode, message, baseError) {
31 if (statusCode === void 0) { statusCode = -1; }
32 var _this = _super.call(this, message || (baseError && baseError.message)) || this;
33 // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
34 Object.setPrototypeOf(_this, GraphError.prototype);
35 _this.statusCode = statusCode;
36 _this.code = null;
37 _this.requestId = null;
38 _this.date = new Date();
39 _this.body = null;
40 _this.stack = baseError ? baseError.stack : _this.stack;
41 return _this;
42 }
43 return GraphError;
44}(Error));
45exports.GraphError = GraphError;
46//# sourceMappingURL=GraphError.js.map
\No newline at end of file