Bug Tracker

Modify

Ticket #1145 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

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:
Blocking: Blocked by:

Description (last modified by john) (diff)

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

comment:1 Changed 6 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 6 years ago by john

  • Owner set to john
  • Version changed from 1.1.2 to 1.1.3
  • Description modified (diff)
  • Milestone changed from 1.1.3 to 1.1.4

comment:3 Changed 6 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in SVN rev [2433].

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.