Class: Sqreen::RemoteException

Inherits:
Event
  • Object
show all
Defined in:
lib/sqreen/events/remote_exception.rb

Overview

When an exception arise it is automatically pushed to the event queue

Instance Attribute Summary

Attributes inherited from Event

#payload, #time

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#to_s

Constructor Details

#initialize(payload_or_exception) ⇒ RemoteException

Returns a new instance of RemoteException.



17
18
19
20
21
22
23
24
# File 'lib/sqreen/events/remote_exception.rb', line 17

def initialize(payload_or_exception)
  payload = if payload_or_exception.is_a?(Hash)
              payload_or_exception
            else
              { 'exception' => payload_or_exception }
            end
  super(payload)
end

Class Method Details

.record(payload_or_exception) ⇒ Object



12
13
14
15
# File 'lib/sqreen/events/remote_exception.rb', line 12

def self.record(payload_or_exception)
  exception = RemoteException.new(payload_or_exception)
  exception.enqueue
end

Instance Method Details

#enqueueObject



26
27
28
# File 'lib/sqreen/events/remote_exception.rb', line 26

def enqueue
  Sqreen.queue.push(self)
end

#klassObject



30
31
32
# File 'lib/sqreen/events/remote_exception.rb', line 30

def klass
  payload['exception'].class.name
end