Swallowed Exception (ARCH6151)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key ruby.logging.swallowed-exception · Severity error · Category logging
The handler catches an exception and silently discards it (rescue nil, returning false), hiding the failure. Unlike an empty block there is a body, but it does not process the exception.
Incorrect
Section titled “Incorrect”def fetch_user(id) User.find(id)rescue nilendCorrect
Section titled “Correct”def fetch_user(id) User.find(id)rescue ActiveRecord::RecordNotFound => e Rails.logger.warn("User not found: #{id}", exception: e) nilendLog the exception structurally and rescue only the expected exception type.