class Bugsnag::Middleware::SessionData

Attaches information about current session to an error report

Public Class Methods

new(bugsnag) click to toggle source
# File lib/bugsnag/middleware/session_data.rb, line 5
def initialize(bugsnag)
  @bugsnag = bugsnag
end

Public Instance Methods

call(report) click to toggle source
# File lib/bugsnag/middleware/session_data.rb, line 9
def call(report)
  session = Bugsnag::SessionTracker.get_current_session

  if session && !session[:paused?]
    if report.unhandled
      session[:events][:unhandled] += 1
    else
      session[:events][:handled] += 1
    end

    report.session = session
  end

  @bugsnag.call(report)
end