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_error end
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?
No comments:
Post a Comment