Class: Rookout::Processor::RookError

Inherits:
Object
  • Object
show all
Defined in:
lib/rookout/processor/rook_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception, message = "") ⇒ RookError

Returns a new instance of RookError.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rookout/processor/rook_error.rb', line 11

def initialize exception, message = ""
  @exception = exception
  @traceback = exception.backtrace

  if @exception.is_a? Exceptions::ToolException
    raw_type = @exception.class.to_s
    @type = raw_type[raw_type.rindex(":") + 1..raw_type.length]
    @message = @exception.message
    @parameters = @exception.parameters
  else
    @type = "Unknown"
    @message = message
    @parameters = nil
  end
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



28
29
30
# File 'lib/rookout/processor/rook_error.rb', line 28

def exception
  @exception
end

#messageObject (readonly)

Returns the value of attribute message.



27
28
29
# File 'lib/rookout/processor/rook_error.rb', line 27

def message
  @message
end

#parametersObject (readonly)

Returns the value of attribute parameters.



29
30
31
# File 'lib/rookout/processor/rook_error.rb', line 29

def parameters
  @parameters
end

Instance Method Details

#dumpsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rookout/processor/rook_error.rb', line 31

def dumps
  parameters = NamespaceSerializer.dump Namespaces::RubyObjectNamespace.new(@parameters), false
  exception = NamespaceSerializer.dump Namespaces::RubyObjectNamespace.new(@exception), false

  backtrace_string = ""
  unless @exception.backtrace.nil?
    backtrace_string = @exception.backtrace.join "\n\t"
  end
  backtrace_object = Namespaces::RubyObjectNamespace.new(backtrace_string).tailor_limits!
  traceback = NamespaceSerializer.dump backtrace_object, false

  Com::Rookout::Error.new message: @message,
                          type: @type,
                          parameters: parameters,
                          exc: exception,
                          traceback: traceback
end