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

Function toErrorMessage

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

Source from the content-addressed store, hash-verified

92};
93
94const toErrorMessage = (cause: unknown): string => {
95 if (typeof cause === "object" && cause !== null) {
96 const message =
97 "message" in cause && typeof cause.message === "string" ? cause.message : undefined;
98
99 if (message) {
100 return message;
101 }
102
103 const stack = "stack" in cause && typeof cause.stack === "string" ? cause.stack : undefined;
104
105 if (stack) {
106 return stack;
107 }
108 }
109
110 const error = toError(cause);
111 return error.stack ?? error.message;
112};
113
114const serializeJson = (value: unknown, label: string): string | undefined => {
115 if (typeof value === "undefined") {

Callers 1

normalizeExecutionErrorFunction · 0.70

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected