提交 d6102304 编写于 作者: M mindless

Handle http error responses more gracefully for field validators and f:validateButton.

Just show "ERROR" and show full error response only when this is clicked.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30304 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e2666f06
......@@ -121,7 +121,11 @@ var FormChecker = {
this.sendRequest(next.url, {
method : next.method,
onComplete : function(x) {
next.target.innerHTML = x.responseText;
var i;
next.target.innerHTML = x.status==200 ? x.responseText
: '<a href="" onclick="document.getElementById(\'valerr' + (i=iota++)
+ '\').style.display=\'block\';return false">ERROR</a><div id="valerr'
+ i + '" style="display:none">' + x.responseText + '</div>';
Behaviour.applySubtree(next.target);
FormChecker.inProgress--;
FormChecker.schedule();
......@@ -1899,7 +1903,11 @@ function validateButton(checkUrl,paramList,button) {
parameters: parameters,
onComplete: function(rsp) {
spinner.style.display="none";
target.innerHTML = rsp.responseText;
var i;
target.innerHTML = rsp.status==200 ? rsp.responseText
: '<a href="" onclick="document.getElementById(\'valerr' + (i=iota++)
+ '\').style.display=\'block\';return false">ERROR</a><div id="valerr'
+ i + '" style="display:none">' + rsp.responseText + '</div>';
var s = rsp.getResponseHeader("script");
if(s!=null)
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册