Class: XRay::Cause

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-xray-sdk/model/cause.rb

Overview

Represents cause section in segment and subsegment document. It records information about application runtime exceptions.

Constant Summary collapse

@@depth =
15

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception: nil, id: nil, remote: false) ⇒ Cause

Returns a new instance of Cause.



10
11
12
13
14
15
# File 'lib/aws-xray-sdk/model/cause.rb', line 10

def initialize(exception: nil, id: nil, remote: false)
  if exception
    @exception_h = normalize e: exception, remote: remote
  end
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/aws-xray-sdk/model/cause.rb', line 7

def id
  @id
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
25
# File 'lib/aws-xray-sdk/model/cause.rb', line 17

def to_h
  return id if id
  h = {
    working_directory: Dir.pwd,
    paths:             Gem.paths.path,
    exceptions:        @exception_h
  }
  h
end

#to_jsonObject



27
28
29
30
31
# File 'lib/aws-xray-sdk/model/cause.rb', line 27

def to_json
  @to_json ||= begin
    MultiJson.dump to_h
  end
end