Exception: Pixmatch::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Pixmatch::Error
- Defined in:
- lib/pixmatch/error.rb
Overview
Custom error class for rescuing from all known Pixmatch errors.
Instance Attribute Summary collapse
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#method ⇒ Object
Returns the value of attribute method.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(json) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 11 |
# File 'lib/pixmatch/error.rb', line 6 def initialize(json) @status = json['status'] @method = json['method'] @error = json['error'] @result = json['result'] end |
Instance Attribute Details
#detail ⇒ Object
Returns the value of attribute detail.
4 5 6 |
# File 'lib/pixmatch/error.rb', line 4 def detail @detail end |
#method ⇒ Object
Returns the value of attribute method.
4 5 6 |
# File 'lib/pixmatch/error.rb', line 4 def method @method end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/pixmatch/error.rb', line 4 def status @status end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 |
# File 'lib/pixmatch/error.rb', line 13 def to_s s = @error.nil? ? 'Unexpected Error' : @error.join('\r\n') s += ("\r\n " + @result.join('\r\n ')) if @result end |