(cause: unknown)
| 4185 | return Effect.gen(function* () { |
| 4186 | // 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 |
| 4187 | const formatInvocationCauseMessage = (cause: unknown): string => { |
| 4188 | if (cause instanceof Error && cause.message.length > 0) return cause.message; |
| 4189 | // Non-Error / empty-message causes: `String(plainObject)` renders |
| 4190 | // "[object Object]", which is what telemetry then shows as the only |
| 4191 | // label for the failure. Prefer the tag, else stringify structurally. |
| 4192 | if (typeof cause === "object" && cause !== null) { |
| 4193 | const tag = (cause as { readonly _tag?: unknown })._tag; |
| 4194 | if (typeof tag === "string") return tag; |
| 4195 | return Inspectable.toStringUnknown(cause, 0); |
| 4196 | } |
| 4197 | return String(cause); |
| 4198 | }; |
| 4199 | // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check |
| 4200 | const wrapInvocationError = <A, E>( |
| 4201 | effect: Effect.Effect<A, E>, |
no outgoing calls
no test coverage detected