TanStackT
TanStack4y ago
4 replies
ill-bronze

Selector for rejected promises

Hi, is there a way to select and transform the body from an error response,
If I get this from the API:
{ result: null, error: { message: "something is wrong" } }

and I want to select the error object from the response (so the react query error object would be just { message: "something is wrong" }), I know we can pass a select callback to transform the result when the promise success, but I don't see something like that for rejected promises.
Was this page helpful?