Module: GrapeOnRails::ErrorFormatter

Included in:
API
Defined in:
lib/grape_on_rails/error_formatter.rb

Instance Method Summary collapse

Instance Method Details

#render_error(error_name, message, http_status) ⇒ Object



3
4
5
6
7
8
# File 'lib/grape_on_rails/error_formatter.rb', line 3

def render_error error_name, message, http_status
  render json: {
    GoR.error_code_key => GoR.errors.public_send(error_name).code,
    GoR.error_message_key => message
  }, status: http_status
end