UNPKG

@knora/api

Version:

JavaScript library that handles API requests to Knora

79 lines 2.58 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 (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; 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 api_response_1 = require("./api-response"); var ApiResponseError = /** @class */ (function (_super) { __extends(ApiResponseError, _super); // </editor-fold> ///////////////// // CONSTRUCTOR // ///////////////// // <editor-fold desc=""> /** * Constructor. */ function ApiResponseError() { var _this = _super.call(this) || this; /////////////// // CONSTANTS // /////////////// // <editor-fold desc=""> // </editor-fold> //////////////// // PROPERTIES // //////////////// // <editor-fold desc=""> /** * Detailed error, if applicable */ _this.error = ""; return _this; } // </editor-fold> ///////////// // METHODS // ///////////// // <editor-fold desc=""> /** * Create an instance from an AjaxError. */ ApiResponseError.fromAjaxError = function (ajaxError) { var response = new ApiResponseError(); if (ajaxError.request.method) response.method = ajaxError.request.method; if (ajaxError.request.url) response.url = ajaxError.request.url; if (ajaxError.xhr) response.status = ajaxError.xhr.status; response.error = ajaxError; return response; }; /** * Create an instance from an error string. * @param responseData * @param error */ ApiResponseError.fromErrorString = function (error, responseData) { var response = new ApiResponseError(); response.method = responseData.method; response.url = responseData.url; response.status = responseData.status; response.error = error; return response; }; return ApiResponseError; }(api_response_1.ApiResponse)); exports.ApiResponseError = ApiResponseError; //# sourceMappingURL=api-response-error.js.map