Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.64 KB

effect-try-without-catch.md

File metadata and controls

64 lines (52 loc) · 1.64 KB

effectTryWithoutCatch

Reports Effect.try and Effect.tryPromise calls without a catch handler, whose failures surface as a generic unknown error

Property Value
Category Anti-pattern
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377169
Language Service name effectTryWithoutCatch
Oxlint name effecttsgo/effect-try-without-catch

Preview

import { Effect } from "effect"

declare const text: string
export const parsed = Effect.try(() => JSON.parse(text))
/**
                      ^^^^^^^^^^ effecttsgo(effect-try-without-catch): Effect.try is called without a `catch` handler, so failures surface as the generic `UnknownError`. The object form `{ try, catch }` maps the cause to a typed, domain-specific error.
*/

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": {
          "effectTryWithoutCatch": "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/effect-try-without-catch": "warn"
  }
}