MCPcopy Create free account
hub / github.com/Effect-TS/effect / decodeJsonError

Function decodeJsonError

packages/effect/src/SchemaTransformation.ts:1295–1303  ·  view source on GitHub ↗
(input: JsonError)

Source from the content-addressed store, hash-verified

1293 Predicate.isObject(input) && typeof input["message"] === "string"
1294
1295const 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
1305const encodeUnknownAsJson = (input: unknown): Json => {
1306 try {

Callers 1

decodeDefectFunction · 0.85

Calls 1

decodeDefectFunction · 0.85

Tested by

no test coverage detected