Skip to content

Commit 7dbcc97

Browse files
committed
Rack: clear context in ensure. If Sentry causes exception, make sure we still clear contexts
1 parent bc8988a commit 7dbcc97

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/raven/integrations/rack.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ def initialize(app)
4141
end
4242

4343
def call(env)
44-
# clear context at the beginning of the request to ensure a clean slate
45-
Context.clear!
46-
BreadcrumbBuffer.clear!
47-
4844
# store the current environment in our local context for arbitrary
4945
# callers
5046
env['raven.requested_at'] = Time.now
@@ -64,6 +60,9 @@ def call(env)
6460
Raven::Rack.capture_exception(error, env) if error
6561

6662
response
63+
ensure
64+
Context.clear!
65+
BreadcrumbBuffer.clear!
6766
end
6867
end
6968

0 commit comments

Comments
 (0)