Methods
- C
-
- N
-
- R
-
Class Public methods
new(app, rescuers = {}, &block)
Source:
show
| on GitHub
def initialize(app, rescuers = {}, &block)
@app, @rescuers = app, {}
rescuers.each { |exception, rescuer| rescue_from(exception, rescuer) }
instance_eval(&block) if block_given?
end
Instance Public methods
Source:
show
| on GitHub
def call(env)
@app.call(env)
rescue Exception => exception
if rescuer = @rescuers[exception.class.name]
env['action_dispatch.rescue.exception'] = exception
rescuer.call(env)
else
raise exception
end
end
Instance Protected methods
rescue_from(exception, rescuer)
Source:
show
| on GitHub
def rescue_from(exception, rescuer)
exception = exception.class.name if exception.is_a?(Exception)
@rescuers[exception.to_s] = rescuer
end