Exception: FreebaseAPI::Error
- Inherits:
-
StandardError
- Object
- StandardError
- FreebaseAPI::Error
- Defined in:
- lib/freebase_api/exceptions.rb
Overview
A class for returning errors from the Freebase API
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(params) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 |
# File 'lib/freebase_api/exceptions.rb', line 6 def initialize(params) FreebaseAPI.logger.error("#{params['message']} (#{params['code']})") self.code = params['code'] self. = params['message'] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/freebase_api/exceptions.rb', line 4 def code @code end |
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/freebase_api/exceptions.rb', line 4 def errors @errors end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/freebase_api/exceptions.rb', line 4 def @message end |
Instance Method Details
#to_s ⇒ Object
12 13 14 |
# File 'lib/freebase_api/exceptions.rb', line 12 def to_s "#{self.} (#{self.code})" end |