mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Ensure RequestTracker handles bubbled exceptions correctly (#26940)
This can happen for various reasons including rate limiting and middleware bugs. This should resolve the warning we're seeing in the logs ``` RequestTracker.get_data failed : NoMethodError : undefined method `[]' for nil:NilClass ```
This commit is contained in:
@@ -120,7 +120,10 @@ class Middleware::RequestTracker
|
||||
|
||||
def self.get_data(env, result, timing, request = nil)
|
||||
status, headers = result
|
||||
|
||||
# result may be nil if the downstream app raised an exception
|
||||
status = status.to_i
|
||||
headers ||= {}
|
||||
|
||||
request ||= Rack::Request.new(env)
|
||||
helper = Middleware::AnonymousCache::Helper.new(env, request)
|
||||
|
||||
Reference in New Issue
Block a user