Exception: Layer::Exceptions::Exception

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/layer/exceptions.rb

Direct Known Subclasses

ClientException, ResourceException

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_exception = nil) ⇒ Exception

Returns a new instance of Exception.



17
18
19
# File 'lib/layer/exceptions.rb', line 17

def initialize(original_exception = nil)
  @original_exception = original_exception
end

Instance Attribute Details

#original_exceptionObject (readonly)

Returns the value of attribute original_exception.



15
16
17
# File 'lib/layer/exceptions.rb', line 15

def original_exception
  @original_exception
end

Instance Method Details

#messageObject



21
22
23
# File 'lib/layer/exceptions.rb', line 21

def message
  "#{original_exception.message}\n\n#{JSON.pretty_generate(response_json)}\n\n"
end

#response_jsonObject



25
26
27
# File 'lib/layer/exceptions.rb', line 25

def response_json
  JSON.parse(original_exception.http_body)
end