tryCatchInEffectGen
August 4, 2026 ยท View on GitHub
Discourages try/catch in Effect generators in favor of Effect error handling
| Property | Value |
|---|---|
| Category | Anti-pattern |
| Default severity | suggestion |
| Fixable | No |
| Effect versions | v3, v4 |
| Diagnostic codes | TS377012 |
| Language Service name | tryCatchInEffectGen |
| Oxlint name | effecttsgo/try-catch-in-effect-gen |
Preview
import * as Effect from "effect/Effect"
export const preview = Effect.gen(function*() {
try { return yield* Effect.succeed(1) }
/**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(try-catch-in-effect-gen): This Effect generator contains `try/catch`; in this context, error handling is expressed with Effect APIs such as Effect.try, Effect.tryPromise, Effect.catch, Effect.catchTag).
*/
catch { return 0 }
/**
^^^^^^^^^^^^^^^^^^^^
*/
})
Language Service Configuration
See the Language Service setup guide for installation instructions.
{
"$schema": "./node_modules/@effect/tsgo/schema.json",
"compilerOptions": {
"plugins": [
{
"name": "@effect/language-service",
"diagnosticSeverity": {
"tryCatchInEffectGen": "warning"
}
}
]
}
}
Oxlint Configuration
See the Oxlint setup guide for installation and patching instructions.
{
"$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
"options": {
"typeAware": true
},
"plugins": ["effecttsgo"],
"rules": {
"effecttsgo/try-catch-in-effect-gen": "warn"
}
}