(input: JsonError)
| 1082 | Predicate.isObject(input) && typeof input["message"] === "string" |
| 1083 | |
| 1084 | const decodeJsonError = (input: JsonError): Error => { |
| 1085 | const hasCause = Object.hasOwn(input, "cause") |
| 1086 | const err = hasCause |
| 1087 | ? new Error(input.message, { cause: decodeDefect(input.cause as Json) }) |
| 1088 | : new Error(input.message) |
| 1089 | if (typeof input.name === "string" && input.name !== "Error") err.name = input.name |
| 1090 | if (typeof input.stack === "string") err.stack = input.stack |
| 1091 | return err |
| 1092 | } |
| 1093 | |
| 1094 | const encodeUnknownAsJson = (input: unknown): Json => { |
| 1095 | try { |
no test coverage detected