Exception: Digitalocean::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Digitalocean::Error
- Defined in:
- lib/digitalocean/errors.rb
Overview
Base Error
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 11 12 13 14 |
# File 'lib/digitalocean/errors.rb', line 6 def initialize(data=nil) @message = case data when Hash @code = data[:code] data[:message] else data end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/digitalocean/errors.rb', line 4 def code @code end |
Instance Method Details
#message ⇒ Object
16 17 18 |
# File 'lib/digitalocean/errors.rb', line 16 def code ? "(#{code}) #{@message}" : @message end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/digitalocean/errors.rb', line 20 def to_s end |