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

Function formatInvocationCauseMessage

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

Source from the content-addressed store, hash-verified

6357 return Effect.gen(function* () {
6358 // 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
6359 const formatInvocationCauseMessage = (cause: unknown): string => {
6360 if (cause instanceof Error && cause.message.length > 0) return cause.message;
6361 // Non-Error / empty-message causes: `String(plainObject)` renders
6362 // "[object Object]", which is what telemetry then shows as the only
6363 // label for the failure. Prefer the tag, else stringify structurally.
6364 if (typeof cause === "object" && cause !== null) {
6365 const tag = (cause as { readonly _tag?: unknown })._tag;
6366 if (typeof tag === "string") return tag;
6367 return Inspectable.toStringUnknown(cause, 0);
6368 }
6369 return String(cause);
6370 };
6371 // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check
6372 const wrapInvocationError = <A, E>(
6373 effect: Effect.Effect<A, E>,

Callers 1

wrapInvocationErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected