@github1/ajax-service
Advanced tools
Comparing version 0.4.59 to 0.4.60
@@ -5,2 +5,3 @@ "use strict"; | ||
var tslib_1 = require("tslib"); | ||
var types_1 = require("./types"); | ||
var constants_1 = require("./constants"); | ||
@@ -41,6 +42,3 @@ var prepare_options_1 = require("./prepare_options"); | ||
return resPromise.then(function (resp) { | ||
var err = new Error("".concat(fetchResponse.status)); | ||
err.status = resp.status; | ||
err.response = resp; | ||
throw err; | ||
throw new types_1.AjaxServiceError(resp); | ||
}); | ||
@@ -47,0 +45,0 @@ } |
@@ -22,2 +22,7 @@ import constants from './constants'; | ||
}; | ||
export declare class AjaxServiceError extends Error { | ||
readonly response: AjaxServiceResponse; | ||
constructor(response: AjaxServiceResponse); | ||
} | ||
export declare function isAjaxServiceError(err: Error): err is AjaxServiceError; | ||
export type RetryState = { | ||
@@ -24,0 +29,0 @@ err: Error & { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isAjaxServiceError = exports.AjaxServiceError = void 0; | ||
var tslib_1 = require("tslib"); | ||
var AjaxServiceError = (function (_super) { | ||
tslib_1.__extends(AjaxServiceError, _super); | ||
function AjaxServiceError(response) { | ||
var _this = _super.call(this, "".concat(response.status)) || this; | ||
_this.response = response; | ||
return _this; | ||
} | ||
return AjaxServiceError; | ||
}(Error)); | ||
exports.AjaxServiceError = AjaxServiceError; | ||
function isAjaxServiceError(err) { | ||
return err && 'response' in err; | ||
} | ||
exports.isAjaxServiceError = isAjaxServiceError; | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "@github1/ajax-service", | ||
"private": false, | ||
"version": "0.4.59", | ||
"version": "0.4.60", | ||
"description": "Library for invoking HTTP requests for JSON and AMF media types", | ||
@@ -18,3 +18,3 @@ "main": "es5/index.js", | ||
"devDependencies": { | ||
"@github1/build-tools": "^0.4.59" | ||
"@github1/build-tools": "^0.4.60" | ||
}, | ||
@@ -21,0 +21,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27659
394