Module: WithErrorsFilter
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/with_errors_filter.rb
Instance Method Summary collapse
Instance Method Details
#catch_exceptions ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/concerns/with_errors_filter.rb', line 9 def catch_exceptions yield rescue ActiveRecord::RecordInvalid => e render! e.record.errors end |
#catch_unhandled_errors(e) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/concerns/with_errors_filter.rb', line 15 def catch_unhandled_errors(e) summary = { errors: { :exception => "#{e.class.name} : #{e.}" } } summary[:trace] = e.backtrace[0, 10] if Rails.env.development? render json: summary, status: :internal_server_error end |