Why this matters
Empty catch blocks hide errors and make debugging difficult. Always log or handle errors properly to prevent silent failures.
Ensure that catch blocks do not remain empty. Empty catch blocks hide errors, making debugging difficult. Recommend logging or handling errors properly.
Empty catch blocks hide errors and make debugging difficult. Always log or handle errors properly to prevent silent failures.
Side-by-side examples engineers can pattern-match during review.
try {
doSomething();
} catch (e) {
// Ignored
}try {
doSomething();
} catch (e) {
console.error("Error occurred:", e);
}
try {
doSomething();
} catch (e) {
// Ignored
}try {
doSomething();
} catch (e) {
console.error("Error occurred:", e);
}
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.