UNPKG

@gqlts/runtime

Version:

Gqlts runtime client

29 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClientError = void 0; var tslib_1 = require("tslib"); var ClientError = /** @class */ (function (_super) { tslib_1.__extends(ClientError, _super); function ClientError(errors) { var _newTarget = this.constructor; var _this = this; var message = ClientError.extractMessage(errors); _this = _super.call(this, errors ? "".concat(message, "\n").concat(errors.map(function (error) { return JSON.stringify(error, null, 2); }).join('\n')) : message) || this; _newTarget.prototype.name = _newTarget.name; Object.setPrototypeOf(_this, _newTarget.prototype); if (Error.captureStackTrace) Error.captureStackTrace(_this, ClientError); return _this; } ClientError.extractMessage = function (errors) { try { return errors[0].message; } catch (e) { return "GraphQL Error"; } }; return ClientError; }(Error)); exports.ClientError = ClientError; //# sourceMappingURL=error.js.map