(error: unknown)
| 342 | } |
| 343 | |
| 344 | function getSerializedBffError(error: unknown): SerializedError | null { |
| 345 | if (isSerializedError(error)) { |
| 346 | return error |
| 347 | } |
| 348 | |
| 349 | if (!isRecord(error)) { |
| 350 | return null |
| 351 | } |
| 352 | |
| 353 | const nestedError = error.error |
| 354 | |
| 355 | if (isSerializedError(nestedError)) { |
| 356 | return nestedError |
| 357 | } |
| 358 | |
| 359 | const rpcSerializedError = error['@@error'] |
| 360 | |
| 361 | if (isSerializedError(rpcSerializedError)) { |
| 362 | return rpcSerializedError |
| 363 | } |
| 364 | |
| 365 | return null |
| 366 | } |
| 367 | |
| 368 | function isSerializedError(error: unknown): error is SerializedError { |
| 369 | if (!isRecord(error)) { |
no test coverage detected