You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
1.1 KiB
22 lines
1.1 KiB
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
function fetchErrorHandler(response) {
|
|
// alertify.success('Current position : ' + alertify.get('notifier', 'position'));
|
|
if (!response.ok) {
|
|
return response.text().catch(function (err) {
|
|
// the status was not ok and there is no json body
|
|
// throw new Error(response.statusText);
|
|
// window.alert(sprintf('Some error occured. Http code is %s', response.status));
|
|
// alertify.error(sprintf('Some error occured. Http code is %s', response.status));
|
|
return true;
|
|
}).then(function (json) {
|
|
// the status was not ok but there is a json body
|
|
// throw new Error(json.error.message); // example error message returned by a REST API
|
|
// window.alert(sprintf('Error: %s (Http code %s)', json, response.status));
|
|
// alertify.error(sprintf('Some error occured. Http code is %s', response.status));
|
|
console.log(json);
|
|
return true;
|
|
});
|
|
}
|
|
}
|
|
exports.fetchErrorHandler = fetchErrorHandler;
|