-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
There are few places in the code that we raise an exception instead of throw :error and vice-versa.
- Grape::Middleware::Versioner::AcceptVersionHeader middleware is throwing but Grape::Middleware::Versioner::Header is raising.
- Running validators is raising.
- Both
throwandexceptionare dealt by error_response inGrape::Middleware::ErrorandGrape::Exceptions::Baseneeds the[]operator so the code can work when itsHashor `Exception. This is really confusing.
We should be consistent in the code base since we mostly treat throw like exception. For instance, when dealing with Grape::Exceptions::ValidationErrors, we rescue them through rescue_from and throw and :error afterward with the backtrace and original_exception.