Why this matters
Ignoring exceptions can hide potential bugs. Handle them properly or log them for debugging purposes.
Always handle or log caught exceptions instead of silently ignoring them to improve debugging and maintain application stability.
Ignoring exceptions can hide potential bugs. Handle them properly or log them for debugging purposes.
Side-by-side examples engineers can pattern-match during review.
void save() {
try {
saveDocument();
} catch (exception) {
}
}void save() {
try {
saveDocument();
} catch (exception) {
log(exception);
}
}void save() {
try {
saveDocument();
} catch (exception) {
}
}void save() {
try {
saveDocument();
} catch (exception) {
log(exception);
}
}From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.