Opened 6 years ago

Closed 6 years ago

#17128 closed defect (invalid)

dojo/request cannot access response on error

Reported by: Wouter Hager Owned by: Bryan Forbes
Priority: undecided Milestone: tbd
Component: IO Version: 1.9.0
Keywords: Cc:
Blocked By: Blocking:

Description

When the response for a request has an error header, I cannot access it's properties.

Change History (4)

comment:1 Changed 6 years ago by Wouter Hager

I see now in the code that the response is returned as a property of the error. Not clear from the docs though.

comment:2 Changed 6 years ago by bill

Component: CoreIO
Owner: set to Bryan Forbes

OK, sounds like this should be closed as invalid but maybe Bryan wants to update the docs.

comment:3 Changed 6 years ago by lee

edit : please ignore, im actually looking for a way to do this with request/registry which I'll raise a separate bug against

Last edited 6 years ago by lee (previous) (diff)

comment:4 Changed 6 years ago by Bryan Forbes

Resolution: invalid
Status: newclosed

When the error handler is invoked, it is passed an error object that has a response property:

request(url).then(
    function (data) {
        // good response
    },
    function (error) {
        console.error('An error has occurred. Error code: ' + error.response.status);
    }
);
Note: See TracTickets for help on using tickets.