Catch Without Log Or Rethrow (ARCH6165)
Key ruby.logging.catch-log-only · Severity info · Category logging
A handler that catches and logs an exception, then continues normally without rethrowing, may unintentionally swallow an unrecoverable error. Flow can proceed with corrupt state.
Incorrect
Section titled “Incorrect”def charge(order) gateway.charge(order)rescue PaymentError => e Rails.logger.error("Payment failed", exception: e)endCorrect
Section titled “Correct”def charge(order) gateway.charge(order)rescue PaymentError => e Rails.logger.error("Payment failed", exception: e) raiseendIf you cannot truly recover from the error, rethrow after logging instead of logging and continuing.