Module: PennyWise::ErrorHandler
- Extended by:
- ActiveSupport::Concern, ActiveSupport::Rescuable
- Includes:
- Integration
- Defined in:
- lib/penny_wise/error_handler.rb
Instance Method Summary collapse
Instance Method Details
#error ⇒ Object
17 18 19 |
# File 'lib/penny_wise/error_handler.rb', line 17 def error render_error(params[:code], PennyWise::Exceptions::RenderedErrorPageException.new) end |
#error_report(exception) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/penny_wise/error_handler.rb', line 21 def error_report(exception) "#{exception.class} raised on #{request.fullpath}:" \ "\n#{exception.}" \ "\nBacktrace:" \ "\n#{exception.backtrace.join("\n")}" end |
#render_error(code, exception) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/penny_wise/error_handler.rb', line 28 def render_error(code, exception) , description = PennyWise.configuration..fetch(code, PennyWise.configuration.) error_logger = logger.method(code.to_i < 500 ? :info : :error) error_logger.call "#{code}: #{description}.\n" + error_report(exception) @code = code @message = @description = description error_renderer(code) rescue Exception => handler_exception logger.fatal error_report(PennyWise::Exceptions::ErrorHandlerException.new(exception, handler_exception)) failure_renderer(500) end |