(cause: unknown)
| 4272 | return Effect.gen(function* () { |
| 4273 | // 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 |
| 4274 | const formatInvocationCauseMessage = (cause: unknown): string => { |
| 4275 | if (cause instanceof Error && cause.message.length > 0) return cause.message; |
| 4276 | // Non-Error / empty-message causes: `String(plainObject)` renders |
| 4277 | // "[object Object]", which is what telemetry then shows as the only |
| 4278 | // label for the failure. Prefer the tag, else stringify structurally. |
| 4279 | if (typeof cause === "object" && cause !== null) { |
| 4280 | const tag = (cause as { readonly _tag?: unknown })._tag; |
| 4281 | if (typeof tag === "string") return tag; |
| 4282 | return Inspectable.toStringUnknown(cause, 0); |
| 4283 | } |
| 4284 | return String(cause); |
| 4285 | }; |
| 4286 | // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check |
| 4287 | const wrapInvocationError = <A, E>( |
| 4288 | effect: Effect.Effect<A, E>, |
no outgoing calls
no test coverage detected