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

RTKQ feature proposal: Add transformError property to the endpoints #1139

Closed
donatoaguirre24 opened this issue Jun 6, 2021 · 5 comments · Fixed by #1841
Closed

RTKQ feature proposal: Add transformError property to the endpoints #1139

donatoaguirre24 opened this issue Jun 6, 2021 · 5 comments · Fixed by #1841
Labels
enhancement New feature or request rtk-query
Milestone

Comments

@donatoaguirre24
Copy link

It would be great to have a transformResponse equivalent for errors. The transformError property would allow manipulation of the error returned by a query or mutation before it hits the cache.

This new property would help to decouple error parsing logic from the view. The service will encapsulate the logic, and the views will act just as a presenter of the data/error the query or mutation returns.

@donatoaguirre24 donatoaguirre24 changed the title Feature proposal: RTK Query - Add transformError property to the endpoints RTKQ feature proposal: Add transformError property to the endpoints Jun 6, 2021
@markerikson markerikson added enhancement New feature or request rtk-query labels Jun 7, 2021
@markerikson markerikson added this to the 1.7 milestone Jun 7, 2021
@markerikson markerikson modified the milestones: 1.7, 1.8 Nov 26, 2021
@dreyks
Copy link
Contributor

dreyks commented Dec 16, 2021

I'd love to have this feature! any opinions on this from the team? I can try to come up with a PR if this is something we want to have

@markerikson
Copy link
Collaborator

Yeah, if someone would like to take a stab at this and file a PR, we can look at it.

@phryneas
Copy link
Member

But note that this will probably be touching a lot of types, so it might get very complicated.

@dreyks
Copy link
Contributor

dreyks commented Dec 17, 2021

created #1841 as a first pass. let me know if I'm going the correct direction

@markerikson
Copy link
Collaborator

Merged this - it'll be in the #2401 PR preview builds momentarily, and I'm hoping to put out 1.9.0-alpha.0 in a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rtk-query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants