UNPKG

http-link-dataloader

Version:

[![CircleCI](https://circleci.com/gh/graphcool/http-link-dataloader.svg?style=shield)](https://circleci.com/gh/graphcool/http-link-dataloader) [![npm version](https://badge.fury.io/js/http-link-dataloader.svg)](https://badge.fury.io/js/http-link-dataloade

38 lines 1.47 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var ClientError = /** @class */ (function (_super) { __extends(ClientError, _super); function ClientError(result) { var _this = this; var message = ClientError.extractMessage(result); _this = _super.call(this, message) || this; _this.result = result; // this is needed as Safari doesn't support .captureStackTrace /* tslint:disable-next-line */ if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(_this, ClientError); } return _this; } ClientError.extractMessage = function (response) { try { return response.errors[0].message; } catch (e) { return "GraphQL Error: " + JSON.stringify(response, null, 2); } }; return ClientError; }(Error)); exports.ClientError = ClientError; //# sourceMappingURL=ClientError.js.map