Extra error information when a modal dialog fails

This commit is contained in:
Oliver Walters 2020-10-19 16:42:53 +11:00
parent 957c538136
commit 396b7dba73

View File

@ -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);
}
};