Module: ErrorsHelper

Included in:
API::Base
Defined in:
app/helpers/errors_helper.rb

Instance Method Summary collapse

Instance Method Details

#rescue_status(error_type, error_status, **options) ⇒ Object


2
3
4
5
6
7
8
# File 'app/helpers/errors_helper.rb', line 2

def rescue_status(error_type, error_status, **options)
  rescue_from error_type do |e|
    message = options[:message] || e.message
    body = { message: message, status: error_status }
    error_response(message: body, status: error_status)
  end
end