Module: Ballast::Concerns::ErrorsHandling
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ballast/concerns/errors_handling.rb
Overview
A concern to handle errors. It requires the Ajax concern.
Instance Method Summary (collapse)
-
- (Object) handle_error(exception, layout: "error", title: "Error - Application", format: nil)
Handles an error in the application.
Instance Method Details
- (Object) handle_error(exception, layout: "error", title: "Error - Application", format: nil)
Handles an error in the application.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ballast/concerns/errors_handling.rb', line 18 def handle_error(exception, layout: "error", title: "Error - Application", format: nil) @error = if exception.is_a?(Lazier::Exceptions::Debug) {status: 503, title: "Debug", error: exception., exception: exception} elsif exception.is_a?(::Hash) exception.reverse_merge({title: title}) else {status: 500, title: "Error - #{exception.class}", error: exception., exception: exception} end send_or_render_error(layout, format) end |