diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-04 11:53:21 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-04 11:53:21 +0000 |
commit | 877122a4a14adaac4e8703ae43c96f589804170a (patch) | |
tree | 358e50c9688c08cb39ca78b3274932d0acca7bf3 /misc/drupal.js | |
parent | 9bc7c07cb71efcd941489a3fca7564b8f7709619 (diff) | |
download | brdo-877122a4a14adaac4e8703ae43c96f589804170a.tar.gz brdo-877122a4a14adaac4e8703ae43c96f589804170a.tar.bz2 |
#201141 by yched: instead of 'HTTP error 200' messages when a PHP error occurs, actually display the PHP error message
Diffstat (limited to 'misc/drupal.js')
-rw-r--r-- | misc/drupal.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/misc/drupal.js b/misc/drupal.js index edf621101..a69d5e16c 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -246,6 +246,24 @@ Drupal.getSelection = function (element) { return { 'start': element.selectionStart, 'end': element.selectionEnd }; }; +/** + * Build an error message from ahah response. + */ +Drupal.ahahError = function(xmlhttp, uri) { + if (xmlhttp.status == 200) { + if (jQuery.trim($(xmlhttp.responseText).text())) { + var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText }); + } + else { + var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri, '@text': xmlhttp.responseText }); + } + } + else { + var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status }); + } + return message; +} + // Global Killswitch on the <html> element if (Drupal.jsEnabled) { // Global Killswitch on the <html> element |