mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENHANCEMENT Showing full error message in LeftAndMain JavaScript if Ajax response comes through as text/plain
This commit is contained in:
parent
323edd03cb
commit
5d9c49a321
@ -206,7 +206,15 @@ CMSForm.prototype = {
|
||||
postBody: data,
|
||||
onSuccess : success,
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error saving content', response);
|
||||
var msg;
|
||||
// Only show plain responses, and trim them to avoid long stack traces
|
||||
if(response.getResponseHeader('Content-Type', 'text/plain')) {
|
||||
msg = response.responseText;
|
||||
} else {
|
||||
msg = 'Error saving content';
|
||||
}
|
||||
if(msg.length > 300) msg = longMsg.substr(0,300) + '...';
|
||||
errorMessage(msg);
|
||||
if($('Form_EditForm_action_save') && $('Form_EditForm_action_save').stopLoading) $('Form_EditForm_action_save').stopLoading();
|
||||
_AJAX_LOADING = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user