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 = nil, layout = "error", title = "Error - Application", format = nil)
Handles an error in the application.
Instance Method Details
- (Object) handle_error(exception = nil, 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 30 31 32 33 34 |
# File 'lib/ballast/concerns/errors_handling.rb', line 18 def handle_error(exception = nil, layout = "error", title = "Error - Application", format = nil) @error ||= exception if @error.is_a?(Lazier::Exceptions::Debug) then @error_title = "Debug" @error_code = 503 elsif @error.is_a?(Hash) then @error_title = @error[:title] || title @error_code = @error[:status] @error_message = @error[:error] else @error_title = "Error - #{@error.class.to_s}" @error_code = 500 end send_or_render_error(layout, format) end |