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

Review error handling in RTK #4032

Closed
fregante opened this issue Aug 15, 2022 · 4 comments
Closed

Review error handling in RTK #4032

fregante opened this issue Aug 15, 2022 · 4 comments

Comments

@fregante
Copy link
Collaborator

fregante commented Aug 15, 2022

We never followed up on this suggestion by RTK authors:

you should probably handle those errors and use rejectWithValue, or your well-known errors will get mixed up with unpredictable stuff.

Any improvement possible here? Feel free to close otherwise

Related

@BALEHOK
Copy link
Contributor

BALEHOK commented Aug 26, 2022

We can also review the appBaseQuery and the way we get error messages.

  1. A new Axios instance is created for every request. This is not optimal.
  2. Axios throws a rich error object, which we have to serialize any way to store in Redux losing all the benefits of that AxiosError. We possibly could switch to RTK fetchBaseQuery which is meant to work with Redux and eliminate the need for serialization entirely. This may involve the way we get error messages (see p.3).
  3. Getting the error message doesn't have to rely on isAxiosError method. If an error has a response property, we can treat it as an API error.

@fregante
Copy link
Collaborator Author

  1. The logic for server errors is not as simple as you'd expect
    export function selectServerErrorMessage(

Copy link

github-actions bot commented Jan 2, 2024

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

@github-actions github-actions bot added the Stale label Jan 2, 2024
Copy link

github-actions bot commented Jan 9, 2024

This issue was closed because it has been stale for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants