Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error response is missing properties #128

Open
DennisOstertag opened this issue Jun 30, 2021 · 0 comments
Open

Error response is missing properties #128

DennisOstertag opened this issue Jun 30, 2021 · 0 comments

Comments

@DennisOstertag
Copy link

hello,

i noticed the response i can use in redux is different from the one i get in the interceptors.
The error object on the interceptor has all the properties i need, but it looses those on the way to redux.

export const onError = ({ action, next, error }, options) => {
  let errorObject;

  if (!error.response) {
    errorObject = {
      data: error.message,
      status: 0
    };
    if (process.env.NODE_ENV !== 'production') {
      console.log('HTTP Failure in Axios', error);
    }
  } else {
    errorObject = error;
  }

This is how the error is build that i can use in the redux store. Note, that error.response is checked but even if it exists it is not used.
I got everything working with this change:

else {
    errorObject = error.response;
  }

I can submit a pull request for this change, but i do not know if any collaborators are still active in this repo.

Much thanks!

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

No branches or pull requests

1 participant