(cause: unknown)
| 3627 | return Effect.gen(function* () { |
| 3628 | // 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 |
| 3629 | const formatInvocationCauseMessage = (cause: unknown): string => { |
| 3630 | if (cause instanceof Error && cause.message.length > 0) return cause.message; |
| 3631 | // Non-Error / empty-message causes: `String(plainObject)` renders |
| 3632 | // "[object Object]", which is what telemetry then shows as the only |
| 3633 | // label for the failure. Prefer the tag, else stringify structurally. |
| 3634 | if (typeof cause === "object" && cause !== null) { |
| 3635 | const tag = (cause as { readonly _tag?: unknown })._tag; |
| 3636 | if (typeof tag === "string") return tag; |
| 3637 | return Inspectable.toStringUnknown(cause, 0); |
| 3638 | } |
| 3639 | return String(cause); |
| 3640 | }; |
| 3641 | // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check |
| 3642 | const wrapInvocationError = <A, E>( |
| 3643 | effect: Effect.Effect<A, E>, |
no outgoing calls
no test coverage detected