2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-02 05:26:45 +00:00

Display more errors

This commit is contained in:
Oliver 2021-11-04 10:17:38 +11:00
parent b6d48cab2a
commit 4118f98d4d

View File

@ -68,6 +68,8 @@ function inventreeGet(url, filters={}, options={}) {
options.error({ options.error({
error: thrownError error: thrownError
}); });
} else {
showApiError(xhr, url);
} }
} }
}); });
@ -104,6 +106,8 @@ function inventreeFormDataUpload(url, data, options={}) {
if (options.error) { if (options.error) {
options.error(xhr, status, error); options.error(xhr, status, error);
} else {
showApiError(xhr, url);
} }
} }
}); });
@ -139,6 +143,8 @@ function inventreePut(url, data={}, options={}) {
} else { } else {
console.error(`Error on ${method} to '${url}' - STATUS ${xhr.status}`); console.error(`Error on ${method} to '${url}' - STATUS ${xhr.status}`);
console.error(thrownError); console.error(thrownError);
showApiError(xhr, url);
} }
}, },
complete: function(xhr, status) { complete: function(xhr, status) {
@ -162,7 +168,9 @@ function inventreeDelete(url, options={}) {
return inventreePut(url, {}, options); return inventreePut(url, {}, options);
} }
/*
* Display a notification with error information
*/
function showApiError(xhr, url) { function showApiError(xhr, url) {
var title = null; var title = null;