MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / decodeErrorMessage

Function decodeErrorMessage

packages/react/src/api/error-reporting.tsx:28–34  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

26// decode — which only sees own properties — would miss the very sentence the
27// server wrote for the user. Read the property directly.
28const decodeErrorMessage = (value: unknown): Option.Option<{ readonly message: string }> => {
29 if (typeof value !== "object" || value === null) return Option.none();
30 const message: unknown = Reflect.get(value, "message");
31 return typeof message === "string" && message.length > 0
32 ? Option.some({ message })
33 : Option.none();
34};
35
36const TaggedValue = Schema.Struct({ _tag: Schema.String });
37const decodeTaggedValue = Schema.decodeUnknownOption(TaggedValue);

Callers 2

messageFromUnknownFunction · 0.85
messageFromUnknownFunction · 0.85

Calls 1

getMethod · 0.65

Tested by 1

messageFromUnknownFunction · 0.68