Module: Smol::Command::ErrorHandler

Defined in:
lib/smol/command.rb

Instance Method Summary collapse

Instance Method Details

#call(*args, **opts) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/smol/command.rb', line 218

def call(*args, **opts)
  super
rescue => e
  handler = find_error_handler(e)
  if handler
    if handler.is_a?(Symbol)
      send(handler, e)
    else
      instance_exec(e, &handler)
    end
  else
    raise
  end
end