Custom api error handling

I have a namespaced, versioned api (Api::V1::ApiController) and I’m wondering if any of you have any tips for how to handle general errors like NoMethodError. I’d like to be able to return a json error message rather than a normal 500 Internal Server Error.

Thanks!

I would use rescue_from: ActiveSupport::Rescuable::ClassMethods