RuboCop::SocketrySourceRuboCopSocketryStyleGlobalExceptionVariables

class GlobalExceptionVariables

A RuboCop cop that warns against using global exception variables.

This cop discourages the use of:

These global variables are implicit and can make code harder to understand. Instead, use explicit exception handling with rescue blocks and local variables.

good

begin risky_operation rescue => error puts error.message puts error.backtrace.first end

Example.

# bad
begin
  risky_operation
rescue
  puts $!.message
  puts $@.first
end

Signature