Module: JsonHttpError::Handler
- Defined in:
- lib/json_http_error/handler.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/json_http_error/handler.rb', line 4 def included(base) base.rescue_from JsonHttpError do |ex| instance_eval(&ex) end base.rescue_from StandardError do |ex| reply = { error: { status: 'ERROR', code: 500, message: Rails.env.development? ? ex. : 'Server error' } } render status: 500, json: reply end end |