* RTK createAsyncThunk serializes thrown errors into plain objects via * miniSerializeError(). These objects have {name, message, stack} but are * NOT Error instances. This type guard identifies them.
(value: unknown)
| 23 | * NOT Error instances. This type guard identifies them. |
| 24 | */ |
| 25 | function isSerializedError(value: unknown): value is { message: string } { |
| 26 | return ( |
| 27 | typeof value === 'object' && |
| 28 | value !== null && |
| 29 | 'message' in value && |
| 30 | typeof (value as any).message === 'string' |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Extract a human-readable error message from any error shape. |
no outgoing calls
no test coverage detected