diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 14:51:05 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-05-20 14:51:05 -0500 |
commit | fd4043526d9008de30ee82b4ea38efaef01796d0 (patch) | |
tree | befb34873a75fd80ce79ba0a066e757c3c04da56 /phpBB/assets/javascript/core.js | |
parent | 778658f7876db462fdc37fdfa91c02ad0c4baea1 (diff) | |
parent | 67053d0b4efdffa12ba6dce40a0f556a9f88f46c (diff) | |
download | forums-fd4043526d9008de30ee82b4ea38efaef01796d0.tar forums-fd4043526d9008de30ee82b4ea38efaef01796d0.tar.gz forums-fd4043526d9008de30ee82b4ea38efaef01796d0.tar.bz2 forums-fd4043526d9008de30ee82b4ea38efaef01796d0.tar.xz forums-fd4043526d9008de30ee82b4ea38efaef01796d0.zip |
Merge remote-tracking branch 'remotes/cyberalien/ticket/11279' into develop
# By Vjacheslav Trushkin
# Via Vjacheslav Trushkin
* remotes/cyberalien/ticket/11279:
[ticket/11279] Log error in console
[ticket/11279] Clearer AJAX errors
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); } /** |