Closed
Description
Hi, found an interesting case when rescue_from :all
should override outer rescue_from :error_class
class PublicApi < Grape::API
rescue_from ActiveRecord::RecordNotFound do
binding.pry
error_response(status: 403)
end
mount AuthController
end
class AuthController < Grape::API
rescue_from :all do
error_response(status: 403)
end
post :request do
User.find_by!(phone: phone)
end
end
15: rescue_from ActiveRecord::RecordNotFound do
15: binding.pry
16: error_response(status: 403)
17: end
For some reason, it seems to not working correctly. I suppose AuthController rescue_from :all
to be called first.
But if we mount AuthController above rescue_from ActiveRecord::RecordNotFound
it would work correctly.
So, does it look like a bug or additional info to documentation?