({error, methodName, isSubprocess, message})
| 67 | // Better error message when sending messages which cannot be serialized. |
| 68 | // Works with both `serialization: 'advanced'` and `serialization: 'json'`. |
| 69 | export const handleSerializationError = ({error, methodName, isSubprocess, message}) => { |
| 70 | if (isSerializationError(error)) { |
| 71 | throw new Error(`${getMethodName(methodName, isSubprocess)}'s argument type is invalid: the message cannot be serialized: ${String(message)}.`, {cause: error}); |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | const isSerializationError = ({code, message}) => SERIALIZATION_ERROR_CODES.has(code) |
| 76 | || SERIALIZATION_ERROR_MESSAGES.some(serializationErrorMessage => message.includes(serializationErrorMessage)); |
no test coverage detected
searching dependent graphs…