Module: Breath::ApplicationControllerHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/breath/controller/application_controller_helper.rb

Defined Under Namespace

Classes: AuthenticationError

Instance Method Summary collapse

Instance Method Details

#error_message(error) ⇒ Object



85
86
87
# File 'lib/breath/controller/application_controller_helper.rb', line 85

def error_message(error)
  "[ERROR] #{error.to_s}"
end

#render_400(res) ⇒ Object



49
50
51
52
53
# File 'lib/breath/controller/application_controller_helper.rb', line 49

def render_400(res)
  Rails.logger.error error_message(res)

  render json: res, status: 400
end

#render_401(res) ⇒ Object



55
56
57
58
59
# File 'lib/breath/controller/application_controller_helper.rb', line 55

def render_401(res)
  Rails.logger.error error_message(res)

  render json: res, status: 401
end

#render_404(res) ⇒ Object



61
62
63
64
65
# File 'lib/breath/controller/application_controller_helper.rb', line 61

def render_404(res)
  Rails.logger.error error_message(res)

  render json: res, status: 404
end

#render_409(res) ⇒ Object



67
68
69
70
71
# File 'lib/breath/controller/application_controller_helper.rb', line 67

def render_409(res)
  Rails.logger.error error_message(res)

  render json: res, status: 409
end

#render_422(res) ⇒ Object



73
74
75
76
77
# File 'lib/breath/controller/application_controller_helper.rb', line 73

def render_422(res)
  Rails.logger.error error_message(res)

  render json: res, status: 422
end

#render_500(res) ⇒ Object



79
80
81
82
83
# File 'lib/breath/controller/application_controller_helper.rb', line 79

def render_500(res)
  Rails.logger.error error_message(res)

  render json: res, status: 500
end