Class: Cuprum::Error
- Inherits:
-
Object
- Object
- Cuprum::Error
- Defined in:
- lib/cuprum/error.rb
Overview
Wrapper class for encapsulating an error state for a failed Cuprum result. Additional details can be passed by setting the #message or by using a subclass of Cuprum::Error.
Direct Known Subclasses
Cuprum::Errors::CommandNotImplemented, Cuprum::Errors::OperationNotCalled
Instance Attribute Summary collapse
-
#message ⇒ String
readonly
Optional message describing the nature of the error.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
True if the other object has the same class and message; otherwise false.
-
#initialize(message: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message: nil) ⇒ Error
Returns a new instance of Error.
15 16 17 |
# File 'lib/cuprum/error.rb', line 15 def initialize(message: nil) @message = end |
Instance Attribute Details
#message ⇒ String (readonly)
Returns Optional message describing the nature of the error.
20 21 22 |
# File 'lib/cuprum/error.rb', line 20 def @message end |
Instance Method Details
#==(other) ⇒ Boolean
Returns true if the other object has the same class and message; otherwise false.
26 27 28 29 |
# File 'lib/cuprum/error.rb', line 26 def ==(other) other.instance_of?(self.class) && comparable_properties.all? { |prop| send(prop) == other.send(prop) } end |