Skip to content

TypeScript · correctness

no-silent-promise-catch

eslint:no-silent-promise-catch

Disallow `.catch()` and second-argument `.then()` handlers that silently swallow a rejection; log, rethrow, or handle the error.

Default
error
Fix
none
Languages
typescript

Why

A swallowed rejection hides failures and gives callers an indistinguishable fallback value.

Fix

Log, rethrow, or explicitly recover from the rejection; explain intentional teardown suppression.

Before / after

Executed by this rule’s unit tests.

Before

Do not swallow the rejection

src/load.ts · focus
load().catch(() => null);

After

Report the rejection

src/load.ts · focus
load().catch((error) => logger.error({ error }, 'load failed'));

Limits

  • Test files, teardown calls, explanatory comments, non-function handlers, and handlers that consume or report the error are excluded.

Message IDs

silentCatch