Bug Tracker

Opened 13 years ago

Closed 12 years ago

#1145 closed bug (fixed)

error callback does not get called for many errors

Reported by: jakecigar Owned by: john
Priority: major Milestone: 1.1.4
Component: ajax Version: 1.1.3
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by john)

I assumed (incorrectly) that the error callback would be called for malformed xml. it is not. I've had to code around this with the complete callback.

I can now catch safari(webkit), firefox 2 & opera 9, I have no idea what IE will do.

var surveyComplete = function(xrh, status){

var xml = xrh.responseXML if (status!="success")

form.html("<h1>" + status.toUpperCase() + " requesting:<a href='" + url + "'>" + url +"</a></h1>")

.append("<pre>" + xrh.responseText + "</pre>")

else if (!xml) safari webkit

form.text(xrh.responseText).wrap("<pre></pre>")

.prepend("<h1> broken xml:<a href='" + url + "'>" + url +"</a> </h1>")

else if (xml.hasChildNodes && !xml.hasChildNodes()) opera

form.text(xrh.responseText).wrap("<pre></pre>")

.prepend("<h1> broken xml:<a href='" + url + "'>" + url +"</a> </h1>")

else if (xml.firstChild.nodeName == "parsererror") firefox

form.text(xrh.responseText).wrap("<pre></pre>")

.prepend("<h1> broken xml:<a href='" + url + "'>" + url +"</a> </h1>"+ $.xml(xml))

else

surveyProcess(xml)

} $.ajax({url:url,datatype:'xml',complete:surveyComplete})

Change History (3)

comment:1 Changed 13 years ago by malsup

I use similar logic in the Taconite plugin when converting a string to a document:


var ok = doc && doc.documentElement && doc.documentElement.tagName != 'parsererror';


comment:2 Changed 12 years ago by john

Description: modified (diff)
Milestone: 1.1.31.1.4
Owner: set to john
Version: 1.1.21.1.3

comment:3 Changed 12 years ago by john

Resolution: fixed
Status: newclosed

Fixed in SVN rev [2433].

Note: See TracTickets for help on using tickets.