module Roda::RodaPlugins::ErrorHandler::InstanceMethods
def _handle_error(e)
when doing so, log the error using rack.errors and return the response.
of 500. Run after hooks on the rack response, but if any error occurs
Handle the given exception using handle_error, using a default status
def _handle_error(e) res = @_response res.send(:initialize) res.status = 500 res = _roda_handle_route{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
def _roda_after(res)
overridden by Roda.def_roda_before.
Default empty implementation of _roda_after, usually
def _roda_after(res) end
def _roda_handle_main_route
the error handler.
If an error occurs, set the response status to 500 and call
def _roda_handle_main_route begin res = super ensure _roda_after(res) end rescue *opts[:error_handler_classes] => e _handle_error(e) end
def call
the error handler. Old Dispatch API.
If an error occurs, set the response status to 500 and call
def call # RODA4: Remove begin res = super ensure _roda_after(res) end rescue *opts[:error_handler_classes] => e _handle_error(e) end
def handle_error(e)
behavior.
the plugin without installing an error handler doesn’t change
By default, have the error handler reraise the error, so using
def handle_error(e) raise e end