Skip to content

Empty Catch Block (ARCH6150)

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.

def parse_config(path)
YAML.load_file(path)
rescue
# ignore
end
def parse_config(path)
YAML.load_file(path)
rescue => e
Rails.logger.error("Failed to read config: #{path}", exception: e)
{}
end

At minimum log the exception, return a meaningful default, or rethrow; never swallow it silently.