I'd like to catch any RoR exceptions in REST API application with 
'rescue_from'.


rescue_from StandardError do |exception|
  message = Rails.env.production? ? 'API server error' : exception.message
  render json: {status: "Error", message: message}, status: 
:internal_server_errorend


but it catches too much irrelevant exceptions. Can I catch RoR exceptions 
only? Is it a good practice at all? If not, what else you can recommend?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3552a5a5-0bb7-424e-ac75-f8d4c9771198%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to