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

Function formatInvocationCauseMessage

packages/core/sdk/src/executor.ts:6239–6250  ·  view source on GitHub ↗
(cause: unknown)

Source from the content-addressed store, hash-verified

6237 return Effect.gen(function* () {
6238 // oxlint-disable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check -- boundary: normalize arbitrary unknown plugin failures into a human-readable message for ToolInvocationError/telemetry
6239 const formatInvocationCauseMessage = (cause: unknown): string => {
6240 if (cause instanceof Error && cause.message.length > 0) return cause.message;
6241 // Non-Error / empty-message causes: `String(plainObject)` renders
6242 // "[object Object]", which is what telemetry then shows as the only
6243 // label for the failure. Prefer the tag, else stringify structurally.
6244 if (typeof cause === "object" && cause !== null) {
6245 const tag = (cause as { readonly _tag?: unknown })._tag;
6246 if (typeof tag === "string") return tag;
6247 return Inspectable.toStringUnknown(cause, 0);
6248 }
6249 return String(cause);
6250 };
6251 // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check
6252 const wrapInvocationError = <A, E>(
6253 effect: Effect.Effect<A, E>,

Callers 1

wrapInvocationErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected