Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.control-flow

Avoid bare except handlers

Bare exception handlers catch all errors and hide root causes.

#Metadata

Rule ID
py.correctness.bare-except
Severity
high
Confidence
0.96
Languages
python
Presets
recommended, strict
Stability
stable
Applies to
block
Tags
correctness, python, rules-catalog

#Why it matters

Catching every throwable without narrowing can swallow interruptions and make failures hard to diagnose.

#Remediation

Catch specific expected exceptions and let unexpected failures propagate.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/python/py.correctness.bare-except.rule.yaml.