lib/grape/error_formatter/base.rb in grape-0.18.0 vs lib/grape/error_formatter/base.rb in grape-0.19.0
- old
+ new
@@ -13,9 +13,10 @@
unless presenter || env[Grape::Env::GRAPE_ROUTING_ARGS].nil?
# env['api.endpoint'].route does not work when the error occurs within a middleware
# the Endpoint does not have a valid env at this moment
http_codes = env[Grape::Env::GRAPE_ROUTING_ARGS][:route_info].http_codes || []
+
found_code = http_codes.find do |http_code|
(http_code[0].to_i == env[Grape::Env::API_ENDPOINT].status) && http_code[2].respond_to?(:represent)
end if env[Grape::Env::API_ENDPOINT].request
presenter = found_code[2] if found_code