*** misc/drupal.js.ORIG 2010-12-30 10:53:46.000000000 -0200 --- misc/drupal.js 2011-01-03 10:16:07.000000000 -0200 *************** *** 252,269 **** * 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 element --- 252,278 ---- * Build an error message from ahah response. */ Drupal.ahahError = function(xmlhttp, uri) { ! var statusCode, statusText, pathText, responseText, readyStateText, message; ! if (xmlhttp.status) { ! statusCode = "\n" + Drupal.t("An AJAX HTTP error occurred.") + "\n" + Drupal.t("HTTP Result Code: !status", {'!status': xmlhttp.status}); } else { ! statusCode = "\n" + Drupal.t("An AJAX HTTP request terminated abnormally."); } + statusCode += "\n" + Drupal.t("Debugging information follows."); + pathText = "\n" + Drupal.t("Path: !uri", {'!uri': uri} ); + statusText = xmlhttp.statusText ? ("\n" + Drupal.t("StatusText: !statusText", {'!statusText': $.trim(xmlhttp.statusText)})) : ""; + responseText = xmlhttp.responseText ? ("\n" + Drupal.t("ResponseText: !responseText", {'!responseText': $.trim(xmlhttp.responseText)})) : ""; + // Make the responseText more readable by stripping HTML tags and newlines. + responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi,""); + responseText = responseText.replace(/[\n]+\s+/g,"\n"); + + // We don't need readyState except for status==0. + readyStateText = xmlhttp.status == 0 ? ("\n" + Drupal.t("ReadyState: !readyState", {'!readyState': xmlhttp.readyState})) : ""; + + message = statusCode + pathText + statusText + responseText + readyStateText; return message; + } // Global Killswitch on the element