Empty Catch Block (ARCH6150)
Esta página aún no está disponible en tu idioma.
Key ruby.logging.empty-rescue-block · Severity error · Category logging
A rescue block with an empty body (or comments only) silently swallows the exception and hides bugs. Failures slip by unnoticed.
Incorrect
Section titled “Incorrect”def parse_config(path) YAML.load_file(path)rescue # ignoreendCorrect
Section titled “Correct”def parse_config(path) YAML.load_file(path)rescue => e Rails.logger.error("Failed to read config: #{path}", exception: e) {}endAt minimum log the exception, return a meaningful default, or rethrow; never swallow it silently.