Class: Bugsnag::Middleware::SessionData

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/middleware/session_data.rb

Overview

Attaches information about current session to an error report

Instance Method Summary collapse

Constructor Details

#initialize(bugsnag) ⇒ SessionData

Returns a new instance of SessionData.



5
6
7
# File 'lib/bugsnag/middleware/session_data.rb', line 5

def initialize(bugsnag)
  @bugsnag = bugsnag
end

Instance Method Details

#call(report) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bugsnag/middleware/session_data.rb', line 9

def call(report)
  session = Bugsnag::SessionTracker.get_current_session
  unless session.nil?
    if report.unhandled
      session[:events][:unhandled] += 1
    else
      session[:events][:handled] += 1
    end
    report.session = session
  end

  @bugsnag.call(report)
end