UNPKG

api

Version:

Magical SDK generation from an OpenAPI definition 🪄

37 lines (36 loc) • 1.56 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); exports.__esModule = true; var FetchError = /** @class */ (function (_super) { __extends(FetchError, _super); function FetchError(status, data, headers, res) { var _this = _super.call(this, res.statusText) || this; _this.name = 'FetchError'; _this.status = status; _this.data = data; _this.headers = headers; _this.res = res; // We could fix this by updating our target to ES2015 but because we support exporting to CJS // we can't. // // https://www.dannyguo.com/blog/how-to-fix-instanceof-not-working-for-custom-errors-in-typescript/ Object.setPrototypeOf(_this, FetchError.prototype); return _this; } return FetchError; }(Error)); exports["default"] = FetchError;