Shallow Catch

Empty catch blocks that swallow errors silently

warningReliabilityshallow-catch

Why this matters

An empty catch block hides failures completely. The operation fails, but your code continues as if it succeeded — causing data corruption, silent data loss, or inconsistent state.

Bad
try {
  await db.user.update({
    where: { id },
    data: { plan: "pro" },
  });
} catch (e) {
  // TODO: handle error
}
Good
try {
  await db.user.update({
    where: { id },
    data: { plan: "pro" },
  });
} catch (error) {
  console.error("Failed to update user plan:", error);
  throw error;
}

How to fix

Log the error, re-throw it, or handle it explicitly in every catch block. Never leave catch blocks empty.

All rules