Skip to main content

Error Handling

Off by default (modules.error_handling = true to enable). Detects error handling anti-patterns across languages. Prefix: ERR-

FindingSeverityLanguage(s)What it matches
ERR-001WarningAllEmpty catch / except block
ERR-002WarningPythonBare except: (catches everything including KeyboardInterrupt)
ERR-003WarningRust.unwrap() in non-test code
ERR-004WarningRustpanic!() / todo!() / unimplemented!() in non-test code
ERR-005WarningRust.expect() with a non-descriptive message (e.g. "error", "failed", "")
ERR-006InfoJS/TS/JavaCatch block that only logs without re-throwing
ERR-007WarningPythonToo-broad exception (except Exception, except BaseException)
ERR-008WarningJS/TSEmpty .catch(() => {}) callback
ERR-009WarningGoDiscarded error (_ = err)

Note: Rust-specific patterns (ERR-003 – ERR-005) are automatically skipped inside #[test] and #[cfg(test)] blocks, as well as in files under tests/ directories or named test_* / *_spec.rs.

// Bad — ERR-003
let value = map.get("key").unwrap();

// Good
let value = map.get("key").ok_or(MyError::NotFound)?;

// Bad — ERR-005
let cfg = load_config().expect("error");

// Good
let cfg = load_config().expect("Failed to load config file from ~/.config/app.toml");
# Bad — ERR-002
try:
risky()
except:
pass

# Good
try:
risky()
except ValueError as e:
logger.warning("Invalid value: %s", e)