Class: Harbinger::Reporters::ExceptionReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/harbinger/reporters/exception_reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ ExceptionReporter

Returns a new instance of ExceptionReporter.



5
6
7
# File 'lib/harbinger/reporters/exception_reporter.rb', line 5

def initialize(exception)
  @exception = exception
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



3
4
5
# File 'lib/harbinger/reporters/exception_reporter.rb', line 3

def exception
  @exception
end

Instance Method Details

#accept(message) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/harbinger/reporters/exception_reporter.rb', line 9

def accept(message)

  if exception.respond_to?(:class)
    message.append('exception', 'class_name', exception.class.to_s)
  end

  if exception.respond_to?(:backtrace)
    message.append('exception', 'backtrace', Array(exception.backtrace).join("\n"))
  end

  if exception.respond_to?(:message)
    message.append('exception', 'message', exception.message)
  end

end