| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.AjaxTimeoutError = exports.AjaxError = void 0; |
| 4 |
var getXHRResponse_1 = require("./getXHRResponse"); |
| 5 |
var createErrorClass_1 = require("../util/createErrorClass"); |
| 6 |
exports.AjaxError = createErrorClass_1.createErrorClass(function (_super) { |
| 7 |
return function AjaxErrorImpl(message, xhr, request) { |
| 8 |
this.message = message; |
| 9 |
this.name = 'AjaxError'; |
| 10 |
this.xhr = xhr; |
| 11 |
this.request = request; |
| 12 |
this.status = xhr.status; |
| 13 |
this.responseType = xhr.responseType; |
| 14 |
var response; |
| 15 |
try { |
| 16 |
response = getXHRResponse_1.getXHRResponse(xhr); |
| 17 |
} |
| 18 |
catch (err) { |
| 19 |
response = xhr.responseText; |
| 20 |
} |
| 21 |
this.response = response; |
| 22 |
}; |
| 23 |
}); |
| 24 |
exports.AjaxTimeoutError = (function () { |
| 25 |
function AjaxTimeoutErrorImpl(xhr, request) { |
| 26 |
exports.AjaxError.call(this, 'ajax timeout', xhr, request); |
| 27 |
this.name = 'AjaxTimeoutError'; |
| 28 |
return this; |
| 29 |
} |
| 30 |
AjaxTimeoutErrorImpl.prototype = Object.create(exports.AjaxError.prototype); |
| 31 |
return AjaxTimeoutErrorImpl; |
| 32 |
})(); |
| 33 |
//# sourceMappingURL=errors.js.map |