-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Description
I noticed that RTK’s error serialization is rather simple:
redux-toolkit/packages/toolkit/src/createAsyncThunk.ts
Lines 94 to 107 in 64a30d8
export const miniSerializeError = (value: any): SerializedError => { | |
if (typeof value === 'object' && value !== null) { | |
const simpleError: SerializedError = {} | |
for (const property of commonProperties) { | |
if (typeof value[property] === 'string') { | |
simpleError[property] = value[property] | |
} | |
} | |
return simpleError | |
} | |
return { message: String(value) } | |
} |
For example this does not support nested errors, like the new cause
property: https://v8.dev/features/error-cause
I know RTK supports specifying a custom serializeError
as an option, but it'd be great to support the cause
property out of the box, perhaps using an existing solution for error serialization:
Metadata
Metadata
Assignees
Labels
No labels