(cause: unknown)
| 92 | }; |
| 93 | |
| 94 | const toErrorMessage = (cause: unknown): string => { |
| 95 | if (typeof cause === "object" && cause !== null) { |
| 96 | const message = |
| 97 | "message" in cause && typeof cause.message === "string" ? cause.message : undefined; |
| 98 | |
| 99 | if (message) { |
| 100 | return message; |
| 101 | } |
| 102 | |
| 103 | const stack = "stack" in cause && typeof cause.stack === "string" ? cause.stack : undefined; |
| 104 | |
| 105 | if (stack) { |
| 106 | return stack; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | const error = toError(cause); |
| 111 | return error.stack ?? error.message; |
| 112 | }; |
| 113 | |
| 114 | const serializeJson = (value: unknown, label: string): string | undefined => { |
| 115 | if (typeof value === "undefined") { |
no test coverage detected