* Attempts to extract the original `message` property from an error value of uncertain shape. * * @param error - The error in question. * @returns The original message, if it exists and is a non-empty string.
(error: unknown)
| 175 | * @returns The original message, if it exists and is a non-empty string. |
| 176 | */ |
| 177 | function getOriginalMessage(error: unknown): string | undefined { |
| 178 | if ( |
| 179 | isObject(error) && |
| 180 | hasProperty(error, 'message') && |
| 181 | typeof error.message === 'string' && |
| 182 | error.message.length > 0 |
| 183 | ) { |
| 184 | return error.message; |
| 185 | } |
| 186 | return undefined; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Check if the given code is a valid JSON-RPC server error code. |
no outgoing calls
no test coverage detected
searching dependent graphs…