Closed
Description
After updating from 2.0 to 2.1, some of our error handling tests broke. We have various error handlers that would catch errors globally and log some info and we used the context for that. For example:
rescue_from :all do |e|
log_context = {
useragent: context.env['HTTP_USER_AGENT'],
method: context.env['REQUEST_METHOD'],
url: context.env['PATH_INFO'],
querystring: context.env['QUERY_STRING'],
ip: context.env['HTTP_X_REAL_IP'],
accept: context.env['HTTP_ACCEPT'],
content_type: context.env['CONTENT_TYPE'],
params: context.params,
}
logger.log(e, log_context)
error!(e, e.status)
end
But now with 2.1, we're getting:
NameError: undefined local variable or method `context' for #<#<Class:0x0000000323776e08>:0x0000000324f45700>
ruby/lib/grape/error_handling.rb:103:in `block in <module:ErrorHandling>'
I'll try to dig in tomorrow to see if I can figure out which commit caused it, but figured I'd give folks a heads up