diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-05-20 21:35:51 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-05-20 21:35:51 +0300 |
commit | a9c9448ebbaaeef9c120bdf2eaf7360380eabe03 (patch) | |
tree | da5f794ee332317897e8dc19ee6cd5922fb0a125 /phpBB/assets | |
parent | 778658f7876db462fdc37fdfa91c02ad0c4baea1 (diff) | |
download | forums-a9c9448ebbaaeef9c120bdf2eaf7360380eabe03.tar forums-a9c9448ebbaaeef9c120bdf2eaf7360380eabe03.tar.gz forums-a9c9448ebbaaeef9c120bdf2eaf7360380eabe03.tar.bz2 forums-a9c9448ebbaaeef9c120bdf2eaf7360380eabe03.tar.xz forums-a9c9448ebbaaeef9c120bdf2eaf7360380eabe03.zip |
[ticket/11279] Clearer AJAX errors
Display clearer AJAX errors rather than generic error
PHPBB3-11279
Diffstat (limited to 'phpBB/assets')
-rw-r--r-- | phpBB/assets/javascript/core.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index e3f1f9f55b..4b5b5258bc 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -252,9 +252,21 @@ phpbb.ajaxify = function(options) { return; } - function errorHandler() { + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, 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); } /** |