Opened 10 years ago

Closed 8 years ago

#10354 closed enhancement (fixed)

XHR should pass errors to dfd.errBack and not let them bubble up

Reported by: dhaber Owned by: Bryan Forbes
Priority: high Milestone: 1.8
Component: Core Version: 1.4.0b
Keywords: Cc:
Blocked By: Blocking:

Description

In IE (8) if you pass an invalid domain (e.g. http://dklfj.sds) as the url to an xhr call (e.g. dojo.xhrPost) IE will throw an exception during the xhr.open() call of dojo.xhr(). This exception will end up bubbling up to the calling code. In other error cases (e.g. when you get a 404 or invalid JSON data) the exception will be properly caught and passed to the deferred's errback. I think this should occur in this case as well.

Change History (5)

comment:1 Changed 10 years ago by Adam Peller

Component: GeneralCore
Owner: changed from anonymous to James Burke

comment:2 Changed 10 years ago by James Burke

Milestone: tbdfuture

comment:3 Changed 8 years ago by bill

Milestone: future1.8
Owner: changed from James Burke to Bryan Forbes
Status: newassigned
Type: defectenhancement

Reassigning to Bryan since he's implementing dojo/request. For you to either fix or mark as "wontfix". I would mark as wontfix because ISTM like a corner case that we shouldn't bother adding any code for.

comment:4 Changed 8 years ago by Bryan Forbes

In [28801]:

Wrap xhr.open() call to catch errors. refs #10354 !strict

comment:5 Changed 8 years ago by Bryan Forbes

Resolution: fixed
Status: assignedclosed

I went ahead and fixed this for two reasons: it was a very simple fix and also every other browser throws the error in the promise chain instead of how IE8 is doing it. Since Dojo's other tools all smooth over browser inconsistencies, I felt this was a great candidate for fixing.

Note: See TracTickets for help on using tickets.