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

Function toErrorMessage

packages/kernel/runtime-quickjs/src/index.ts:75–93  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

73};
74
75const toErrorMessage = (cause: unknown): string => {
76 if (typeof cause === "object" && cause !== null) {
77 const message =
78 "message" in cause && typeof cause.message === "string" ? cause.message : undefined;
79
80 if (message) {
81 return message;
82 }
83
84 const stack = "stack" in cause && typeof cause.stack === "string" ? cause.stack : undefined;
85
86 if (stack) {
87 return stack;
88 }
89 }
90
91 const error = toError(cause);
92 return error.stack ?? error.message;
93};
94
95const serializeJson = (value: unknown, label: string): string | undefined => {
96 if (typeof value === "undefined") {

Callers 1

normalizeExecutionErrorFunction · 0.70

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected