Skip to content

Files

Latest commit

 

History

History
23 lines (17 loc) · 398 Bytes

prefer-optional-catch-binding.md

File metadata and controls

23 lines (17 loc) · 398 Bytes

Pattern: Unused error parameter in catch clause

Issue: -

Description

When a catch block doesn't use the error parameter, it can be omitted for cleaner code. Modern JavaScript allows catch clauses without binding parameters.

Examples

Example of incorrect code:

try {
  // ...
} catch (e) {}

Example of correct code:

try {
  // ...
} catch {}