diff --git a/InvenTree/InvenTree/static/script/inventree/modals.js b/InvenTree/InvenTree/static/script/inventree/modals.js
index 80ada1596f..49de96468f 100644
--- a/InvenTree/InvenTree/static/script/inventree/modals.js
+++ b/InvenTree/InvenTree/static/script/inventree/modals.js
@@ -354,7 +354,7 @@ function renderErrorMessage(xhr) {
var html = '' + xhr.statusText + '
';
- html += 'Status Code - ' + xhr.status + '
';
+ html += 'Error Code - ' + xhr.status + '
';
html += `
@@ -811,16 +811,37 @@ function launchModalForm(url, options = {}) {
$(modal).modal('hide');
// Permission denied!
- if (xhr.status == 403) {
+ if (xhr.status == 400) {
showAlertDialog(
- "Permission Denied",
+ "Error 400: Bad Request",
+ "Server returned error code 400"
+ );
+ } else if (xhr.status == 401) {
+ showAlertDialog(
+ "Error 401: Not Authenticated",
+ "Authentication credentials not supplied"
+ );
+ } else if (xhr.status == 403) {
+ showAlertDialog(
+ "Error 403: Permission Denied",
"You do not have the required permissions to access this function"
);
-
- return;
+ } else if (xhr.status == 404) {
+ showAlertDialog(
+ "Error 404: Resource Not Found",
+ "The requested resource could not be located on the server"
+ );
+ } else if (xhr.status == 408) {
+ showAlertDialog(
+ "Error 408: Timeout",
+ "Connection timeout while requesting data from server"
+ );
+ } else {
+ showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
}
- showAlertDialog('Error requesting form data', renderErrorMessage(xhr));
+ console.log("Modal form error: " + xhr.status);
+ console.log("Message: " + xhr.responseText);
}
};