Module: ApiKit::Errors
- Defined in:
- lib/api_kit/errors.rb
Overview
Helpers to handle some error responses
Most of the exceptions are handled in Rails by [ActionDispatch] middleware See: api.rubyonrails.org/classes/ActionDispatch/ExceptionWrapper.html
Class Method Summary collapse
-
.included(base) ⇒ Module
Callback will register the error handlers.
Class Method Details
.included(base) ⇒ Module
Callback will register the error handlers
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/api_kit/errors.rb', line 12 def self.included(base) base.class_eval do rescue_from( StandardError, with: :render_api_internal_server_error ) rescue_from( ActiveRecord::RecordNotFound, with: :render_api_not_found ) rescue_from( ActionController::ParameterMissing, with: :render_api_unprocessable_entity ) end end |