UNPKG

2.01 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.GraphClientError = void 0;
10var tslib_1 = require("tslib");
11/**
12 * @module GraphClientError
13 */
14/**
15 * @class
16 * Create GraphClientError object to handle client-side errors
17 * encountered within the JavaScript Client SDK.
18 * Whereas GraphError Class should be used to handle errors in the response from the Graph API.
19 */
20var GraphClientError = /** @class */ (function (_super) {
21 tslib_1.__extends(GraphClientError, _super);
22 /**
23 * @public
24 * @constructor
25 * Creates an instance of GraphClientError
26 * @param {string} message? - Error message
27 * @returns An instance of GraphClientError
28 */
29 function GraphClientError(message) {
30 var _this = _super.call(this, message) || this;
31 Object.setPrototypeOf(_this, GraphClientError.prototype);
32 return _this;
33 }
34 /**
35 * @public
36 * @static
37 * @async
38 * To set the GraphClientError object
39 * @param {any} error - The error returned encountered by the Graph JavaScript Client SDK while processing request
40 * @returns GraphClientError object set to the error passed
41 */
42 GraphClientError.setGraphClientError = function (error) {
43 var graphClientError;
44 if (error instanceof Error) {
45 graphClientError = error;
46 }
47 else {
48 graphClientError = new GraphClientError();
49 graphClientError.customError = error;
50 }
51 return graphClientError;
52 };
53 return GraphClientError;
54}(Error));
55exports.GraphClientError = GraphClientError;
56//# sourceMappingURL=GraphClientError.js.map
\No newline at end of file