Skip to content
← All rules
ErrorsError handling

errors/no-swallowed-errors

Catch handlers should propagate or observably report unexpected errors, while intentional recovery and expected-exception fallbacks remain valid.

catchpropagationreporting
TypeScript
try { await publish(); } catch { return false; }
Finding

Disallow silently suppressed unexpected failures.

Setup

Install the package, register its plugin factory, then enable the rule.

Install the package

pnpm add -D @scruple/errors

Register the plugin

In scruple.config.ts, register the factory under the errors namespace used by the rule ID.

import { errors } from "@scruple/errors";

plugins: {
  "errors": errors(),
},

Enable the rule

"errors/no-swallowed-errors": "warn"
Package
@scruple/errors
Default threshold
0.9
Minimum confidence
0.7

Released under the MIT License.