(cause: unknown)
| 73 | }; |
| 74 | |
| 75 | const toErrorMessage = (cause: unknown): string => { |
| 76 | if (typeof cause === "object" && cause !== null) { |
| 77 | const message = |
| 78 | "message" in cause && typeof cause.message === "string" ? cause.message : undefined; |
| 79 | |
| 80 | if (message) { |
| 81 | return message; |
| 82 | } |
| 83 | |
| 84 | const stack = "stack" in cause && typeof cause.stack === "string" ? cause.stack : undefined; |
| 85 | |
| 86 | if (stack) { |
| 87 | return stack; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | const error = toError(cause); |
| 92 | return error.stack ?? error.message; |
| 93 | }; |
| 94 | |
| 95 | const serializeJson = (value: unknown, label: string): string | undefined => { |
| 96 | if (typeof value === "undefined") { |
no test coverage detected