Browse Source

Intercooler: Display custom message for 413 error

Since a 413 error (Payload Too Large) is returned from nginx and doesn't
even reach the app, we need to handle this in the javascript instead of
the normal method of returning a custom error response.
merge-requests/70/head
Deimos 6 years ago
parent
commit
9fe3cc213a
  1. 7
      tildes/static/js/scripts.js

7
tildes/static/js/scripts.js

@ -59,7 +59,12 @@ $(document).on('complete.ic', function(evt, elt, data, status, xhr, requestId) {
if (status === 'success') {
$statusElement.addClass('form-status-success').text('Saved successfully');
} else {
$statusElement.addClass('form-status-error').text(xhr.responseText);
if (xhr.status === 413) {
errorText = "Too much data submitted";
} else {
errorText = xhr.responseText;
}
$statusElement.addClass('form-status-error').text(errorText);
}
$statusElement.fadeIn('slow');
});

Loading…
Cancel
Save