Exception: Azure::Armrest::Exception

Inherits:
StandardError
  • Object
show all
Defined in:
lib/azure/armrest/exception.rb

Direct Known Subclasses

ApiException

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, cause_exception = nil) ⇒ Exception

Create a new Armrest::Exception object. The message should be an error string, while cause_exception is typically set to the raw RestClient exception.

You will not typically use this object directly.



13
14
15
16
# File 'lib/azure/armrest/exception.rb', line 13

def initialize(message = nil, cause_exception = nil)
  @message = message
  @cause = cause_exception
end

Instance Attribute Details

#causeObject

Returns the value of attribute cause.



4
5
6
# File 'lib/azure/armrest/exception.rb', line 4

def cause
  @cause
end

#messageObject

The error message or, if the message is not set, the name of the exception class.



31
32
33
# File 'lib/azure/armrest/exception.rb', line 31

def message
  @message || self.class.name
end

Instance Method Details

#to_sObject

The stringified version (message) of the exception.



20
21
22
23
24
25
26
# File 'lib/azure/armrest/exception.rb', line 20

def to_s
  if cause
    "#{message} (cause: #{cause})"
  else
    message
  end
end