You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected result: createAsyncTask can be (globally) configured to keep certain attributes on errors from rejections. This could be fully optional and default to the current values.
Note when using thunkAPI.rejectWithValue:
The API feels to be inconsistent because the error in the action is in the payload instead of in the error attribute. There is an error in the error field though but is only including the message attribute of the error.
When using unwrapResult on such a value it will throw only the error from the error attribute which makes further code necessary to get the actual error from the rejected action.
IMHO it would be best to allow to specify which additional attributes on an error should be serialized when a thunk gets rejected in order to use the API in the usual way.
Hey,
I'm having a hard time with error mapping using
reduxjs/redux-toolkit
. The situation is as follows:{ message: string, code: number, label: string, }
miniSerializeError
redux-toolkit/src/createAsyncThunk.ts
Line 50 in de1282c
Result:
The
label
is stripped from the error.Expected result:
createAsyncTask
can be (globally) configured to keep certain attributes on errors from rejections. This could be fully optional and default to the current values.Note when using
thunkAPI.rejectWithValue
:payload
instead of in theerror
attribute. There is an error in the error field though but is only including themessage
attribute of the error.unwrapResult
on such a value it will throw only the error from theerror
attribute which makes further code necessary to get the actual error from the rejected action.IMHO it would be best to allow to specify which additional attributes on an error should be serialized when a thunk gets rejected in order to use the API in the usual way.
Related issues:
#588
The text was updated successfully, but these errors were encountered: