Skip to content

Conversation

@notpushkin
Copy link

Axios returns a custom object when request status is not OK (https://github.com/axios/axios/#handling-errors):

axios.get('/user/12345')
  .catch(function (error) {
    if (error.response) {
      console.log(error.response.data);
      console.log(error.response.status);
      console.log(error.response.headers);
    }
    // ...
  })

Redaxios on the other hand throws the response directly, as pointed out in comment #48 (comment).

The easiest fix would be just to wrap the response in an object, but for better compatibility we could add some other fields.

@developit
Copy link
Owner

LGTM - I might try to refactor this to reject with an Error that has the .response property attached (I assume that's what Axios is doing). The current .catch(Object) trick likely has to go though.

@notpushkin
Copy link
Author

@developit Sorry for bothering – any updates on this? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants