no-fake-error-handling

FreeAI Behavior

Disallow empty catch blocks and catches that only log without handling

no-fake-error-handling

Disallow empty catch blocks and catches that only log without handling

Category: AI Behavior | Tier: Free

Why This Matters

AI wraps code in try/catch blocks but only logs the error and swallows it. The caller never learns the operation failed, leading to silent data loss, corrupted state, and bugs that are extremely difficult to trace.

Bad Code

// AI catches errors but does nothing useful
try {
  await saveUser(user);
} catch (error) {
  console.log(error);
  // swallowed -- caller never knows it failed
}

Good Code

try {
  await saveUser(user);
} catch (error) {
  logger.error('Failed to save user', { userId: user.id, error });
  throw new AppError('User save failed', { cause: error });
}

Configuration

This rule has no configuration options. It is enabled by default in lintmyai:recommended.