slop/swallowed-errors
Errors are not swallowed
| Severity | info |
| Tiers | all |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.3.1 |
| Selected by | fleetlint-slop@v0.3.1 |
Requirement
No empty catch blocks (JavaScript, Java, Kotlin, C#, PHP, Dart), no except: pass, no _ = err, no Ruby rescue nil or rescue; end. Only single-line forms are detected; the stack’s linter covers the rest.
Why
A swallowed error turns a failure with a cause into a wrong result without one.
Check
For each item in:
codegrep("nontest", r'catch\s*(\([^)]*\))?\s*\{\s*\}|except[^:]*:\s*pass\b|\b_\s*=\s*err\b|\.catch\(\s*\(\)\s*=>\s*(\{\s*\}|null|undefined)\s*\)|catch \(_\)|\brescue\s+nil\b|\brescue(\s+[\w:]+)?(\s*=>\s*\w+)?\s*;\s*end\b')falseFix
Handle the error, wrap and return it, or log it where it is handled.
Agent instruction: Propagate the error with context unless the surrounding code shows it is safe to ignore; then say why in a comment.
See: https://fleetlint.org/baseline/#slop, https://fleetlint.org/slop/#errors-types-and-robustness
Generated by fleetlint docs from catalog v0.3.1.