diff options
Diffstat (limited to 'phpBB/assets/javascript/core.js')
| -rw-r--r-- | phpBB/assets/javascript/core.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index e3f1f9f55b..e0f1dc1eef 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -252,9 +252,24 @@ phpbb.ajaxify = function(options) { return; } - function errorHandler() { + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (console && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } phpbb.clearLoadingTimeout(); - phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text')); + var errorText = false; + if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } + else { + errorText = dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) + errorText = dark.attr('data-ajax-error-text'); + } + phpbb.alert(dark.attr('data-ajax-error-title'), errorText); } /** |
