(input: JsonError)
| 1293 | Predicate.isObject(input) && typeof input["message"] === "string" |
| 1294 | |
| 1295 | const decodeJsonError = (input: JsonError): Error => { |
| 1296 | const hasCause = Object.hasOwn(input, "cause") |
| 1297 | const err = hasCause |
| 1298 | ? new Error(input.message, { cause: decodeDefect(input.cause as Json) }) |
| 1299 | : new Error(input.message) |
| 1300 | if (typeof input.name === "string" && input.name !== "Error") err.name = input.name |
| 1301 | if (typeof input.stack === "string") err.stack = input.stack |
| 1302 | return err |
| 1303 | } |
| 1304 | |
| 1305 | const encodeUnknownAsJson = (input: unknown): Json => { |
| 1306 | try { |
no test coverage detected