Async Error Swallow Detector
Find silent failures in your async code — empty catch blocks, swallowed errors — surfaced as inline diagnostics.
The Problem
Silent failures are production's worst bugs. An empty catch(e) {} makes an operation silently fail. A catch block that only calls console.log(e) doesn't propagate the error. A promise .catch(() => {}) discards failures. These compile, they pass linting, and they blow up in production.
What It Does
Async Error Swallow Detector scans TypeScript and JavaScript files for three categories of silent failure patterns and reports them as inline VS Code diagnostics (the same squiggle underlines used by TypeScript errors) — so they show up in the Problems panel and are impossible to miss.
Features
- Three detection rules covering the most dangerous patterns
- Inline squiggle underlines — same UX as TypeScript compiler errors
- Problems panel integration — all issues listed in the Problems tab
- Auto-scan on save — catches issues as you write them (configurable)
- Manual scan — scan a single file or the whole workspace on demand
- Configurable severity — escalate warnings to errors for strict codebases
- Allowed patterns — whitelist legitimate catch patterns
Getting Started
The extension activates automatically when you open a TypeScript or JavaScript file. Issues appear immediately as squiggle underlines.
To scan your entire workspace:
- Run Async Error Swallow: Scan Workspace
Commands
| Command |
Description |
Async Error Swallow: Scan File |
Scan the currently active file |
Async Error Swallow: Scan Workspace |
Scan all .ts/.tsx/.js/.jsx files in the workspace |
Detection Rules
AES001 — Empty Catch Block (error)
// ❌ Detected — error is completely lost
try {
await fetchUser(id);
} catch(e) {}
// ❌ Also detected — inline empty
try { parseConfig(); } catch {}
AES002 — Console-Only Catch (warning)
// ❌ Detected — logged but not propagated
try {
await saveToDatabase(data);
} catch(err) {
console.error(err); // error is logged but swallowed
}
// ✅ OK — error is re-thrown
try {
await saveToDatabase(data);
} catch(err) {
console.error(err);
throw err; // propagated
}
AES003 — Empty Promise .catch() (warning)
// ❌ Detected
fetchData().catch(() => {});
sendAnalytics().catch(e => {});
// ✅ OK
fetchData().catch(err => logger.error('fetch failed', err));
Configuration
| Setting |
Default |
Description |
asyncErrorSwallow.enableOnSave |
true |
Scan files automatically on save |
asyncErrorSwallow.severity |
"warning" |
Diagnostic severity: "error", "warning", or "information" |
asyncErrorSwallow.allowedPatterns |
[] |
Regex patterns for allowed catch content |
Strict mode (treat as errors)
{
"asyncErrorSwallow.severity": "error"
}
Tips
- Run Scan Workspace as part of your code review process
- The Problems panel (
Cmd+Shift+M) lists all detected issues across all open files
- Fix AES001 first — empty catch blocks are always bugs
- AES002 requires judgment: sometimes logging is correct if you handle failure upstream