Module: Roda::RodaPlugins::ErrorHandler::InstanceMethods

Defined in:
lib/roda/plugins/error_handler.rb

Instance Method Summary collapse

Instance Method Details

#callObject

If an error occurs, set the response status to 500 and call the error handler.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/roda/plugins/error_handler.rb', line 76

def call
  super
rescue *opts[:error_handler_classes] => e
  @_response.send(:initialize)
  @_response.status = 500
  res = _call{handle_error(e)}
  begin
    _roda_after(res)
  rescue => e2
    if errors = env['rack.errors']
      errors.puts "Error in after hook processing of error handler: #{e2.class}: #{e2.message}"
      e2.backtrace.each{|line| errors.puts(line)}
    end
  end
  res
end