Class: Binnacle::Trap::ExceptionEvent

Inherits:
Event show all
Defined in:
lib/binnacle/trap/exception_event.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#channel_id, #client_event_time, #client_id, #environment, #event_name, #event_time, #ip_address, #json, #log_level, #session_id, #tags

Attributes inherited from Resource

#connection, #route

Instance Method Summary collapse

Methods inherited from Event

#configure, #configure_from_logging_progname, events, from_hash, recents, #route, route, #timestamp=, #to_json

Methods inherited from Resource

get, #post, #post_asynch

Constructor Details

#initialize(exception, env) ⇒ ExceptionEvent

Returns a new instance of ExceptionEvent.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/binnacle/trap/exception_event.rb', line 26

def initialize(exception, env)
  @exception = unwrap_exception(exception)
  @env = env

  if env["action_dispatch.request.parameters"] != nil
    @component = env['action_dispatch.request.parameters'][:controller] || nil
    @method = env['action_dispatch.request.parameters'][:action] || nil
    @module = env['action_dispatch.request.parameters'][:module] || nil
  end

  @request = ::Rack::Request.new(env)

  extract_event_name
  extract_session_id
  extract_client_id
  extract_backtrace

  self.log_level = "EXCEPTION"
  self.tags = []
  build_json_payload

  configure(
    Binnacle.configuration.error_channel,
    self.event_name,
    self.client_id,
    self.session_id,
    self.log_level,
    nil,
    self.tags,
    self.json
  )
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



24
25
26
# File 'lib/binnacle/trap/exception_event.rb', line 24

def backtrace
  @backtrace
end

#componentObject (readonly)

Returns the value of attribute component.



21
22
23
# File 'lib/binnacle/trap/exception_event.rb', line 21

def component
  @component
end

#envObject (readonly)

Returns the value of attribute env.



19
20
21
# File 'lib/binnacle/trap/exception_event.rb', line 19

def env
  @env
end

#exceptionObject (readonly)

Returns the value of attribute exception.



18
19
20
# File 'lib/binnacle/trap/exception_event.rb', line 18

def exception
  @exception
end

#methodObject (readonly)

Returns the value of attribute method.



22
23
24
# File 'lib/binnacle/trap/exception_event.rb', line 22

def method
  @method
end

#moduleObject (readonly)

Returns the value of attribute module.



23
24
25
# File 'lib/binnacle/trap/exception_event.rb', line 23

def module
  @module
end

#requestObject (readonly)

Returns the value of attribute request.



20
21
22
# File 'lib/binnacle/trap/exception_event.rb', line 20

def request
  @request
end