Skip to content

VBC-943: ignored-catch-variable

warning

Category: clean-code
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: clean-code ai-error

What it reports

Catch clause with ignored error variable at line {line}. Using '_' as the catch binding signals the exception is intentionally discarded. AI-generated code often silently suppresses errors this way, hiding failures in production. Either log the error, re-throw with context, or add an explicit comment explaining why suppression is safe here.

Flagged

js
try { risky(); } catch (_e) { fallback(); }

Not flagged

js
try { risky(); } catch (error) { report(error); }

Pattern

regex
catch\s*\(\s*_[a-zA-Z]?\s*\)\s*\{

Released under the MIT License.