Relative Content

Tag Archive for rubyruby-grape

How to remap exceptions with Grape

In a Ruby project using Grape, I have a custom exception Api::Exceptions::InvalidValueError that subclasses Grape::Exceptions::Base. If a validation fails (which causes Grape::Exceptions::ValidationErrors to be raised), I’d like to return the same response as if Api::Exceptions::InvalidValueError was raised.