endpoint_run.grape
callback is called without middlewares
#2010
Labels
endpoint_run.grape
callback is called without middlewares
#2010
Hello. I'm trying to add the monitoring by subscribing to
'endpoint_run.grape'
viaActiveSupport::Notifications.subscribe
.It works well until an exception occurs inside API. I have a bunch of
rescue_from
blocks to return different status codes depending on exceptions, such asThe problem is when I call an endpoint which raises ActiveRecord::RecordNotFound, it really returns 404 status code, but in my callback
data[:endpoint].status
is still 200 (however data[:exception_object] is not null).A quick look at the code shows, that callback wraps only the main call, without middlewares. I believe, it should wrap middlewares too because:
The text was updated successfully, but these errors were encountered: