You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both throw and exception are dealt by error_response in Grape::Middleware::Error and Grape::Exceptions::Base needs the [] operator so the code can work when its Hash or `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.
The text was updated successfully, but these errors were encountered:
ericproulx
changed the title
raise instead of throwraise instead of throwMay 4, 2025
ericproulx
changed the title
raise instead of throwraise instead of throw ?
May 4, 2025
There are few places in the code that we
raise
an exception instead of throw:error
and vice-versa.throw
andexception
are dealt by error_response inGrape::Middleware::Error
andGrape::Exceptions::Base
needs the[]
operator so the code can work when itsHash
or `Exception. This is really confusing.We should be consistent in the code base since we mostly treat
throw
like exception. For instance, when dealing withGrape::Exceptions::ValidationErrors
, we rescue them throughrescue_from
andthrow
and:error
afterward with thebacktrace
andoriginal_exception
.The text was updated successfully, but these errors were encountered: