|
|
|
@ -12,9 +12,6 @@ module ControllerRescueHandler
|
|
|
|
|
rescue_from ::ActionView::MissingTemplate, with: :missing_template
|
|
|
|
|
rescue_from ActiveRecord::RecordNotFound, with: :object_not_found
|
|
|
|
|
rescue_from ActionController::ParameterMissing, with: :render_parameter_missing
|
|
|
|
|
rescue_from StandardError do |ex|
|
|
|
|
|
render_error(ex.model.errors.full_messages.join(','))
|
|
|
|
|
end
|
|
|
|
|
# form validation error
|
|
|
|
|
rescue_from ActiveModel::ValidationError do |ex|
|
|
|
|
|
render_error(ex.model.errors.full_messages.join(','))
|
|
|
|
@ -22,5 +19,8 @@ module ControllerRescueHandler
|
|
|
|
|
rescue_from ActiveRecord::RecordInvalid do |ex|
|
|
|
|
|
render_error(ex.record.errors.full_messages.join(','))
|
|
|
|
|
end
|
|
|
|
|
rescue_from RuntimeError do |ex|
|
|
|
|
|
render_error(ex.model.errors.full_messages.join(','))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|