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

Function formatInvocationCauseMessage

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

Source from the content-addressed store, hash-verified

3726 return Effect.gen(function* () {
3727 // 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
3728 const formatInvocationCauseMessage = (cause: unknown): string => {
3729 if (cause instanceof Error && cause.message.length > 0) return cause.message;
3730 // Non-Error / empty-message causes: `String(plainObject)` renders
3731 // "[object Object]", which is what telemetry then shows as the only
3732 // label for the failure. Prefer the tag, else stringify structurally.
3733 if (typeof cause === "object" && cause !== null) {
3734 const tag = (cause as { readonly _tag?: unknown })._tag;
3735 if (typeof tag === "string") return tag;
3736 return Inspectable.toStringUnknown(cause, 0);
3737 }
3738 return String(cause);
3739 };
3740 // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check
3741 const wrapInvocationError = <A, E>(
3742 effect: Effect.Effect<A, E>,

Callers 1

wrapInvocationErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected