(cause: unknown)
| 6449 | return Effect.gen(function* () { |
| 6450 | // 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 |
| 6451 | const formatInvocationCauseMessage = (cause: unknown): string => { |
| 6452 | if (cause instanceof Error && cause.message.length > 0) return cause.message; |
| 6453 | // Non-Error / empty-message causes: `String(plainObject)` renders |
| 6454 | // "[object Object]", which is what telemetry then shows as the only |
| 6455 | // label for the failure. Prefer the tag, else stringify structurally. |
| 6456 | if (typeof cause === "object" && cause !== null) { |
| 6457 | const tag = (cause as { readonly _tag?: unknown })._tag; |
| 6458 | if (typeof tag === "string") return tag; |
| 6459 | return Inspectable.toStringUnknown(cause, 0); |
| 6460 | } |
| 6461 | return String(cause); |
| 6462 | }; |
| 6463 | // oxlint-enable executor/no-instanceof-error, executor/no-unknown-error-message, executor/no-manual-tag-check |
| 6464 | const wrapInvocationError = <A, E>( |
| 6465 | effect: Effect.Effect<A, E>, |
no outgoing calls
no test coverage detected