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

Function toErrorMessage

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

Source from the content-addressed store, hash-verified

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

Callers 1

normalizeExecutionErrorFunction · 0.70

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected