Exception: FBUtilError
- Inherits:
-
Exception
- Object
- Exception
- FBUtilError
- Defined in:
- lib/fb_util/fb_util_error.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(error_code, body) ⇒ FBUtilError
constructor
A new instance of FBUtilError.
- #to_s ⇒ Object
Constructor Details
#initialize(error_code, body) ⇒ FBUtilError
Returns a new instance of FBUtilError.
4 5 6 7 8 9 10 11 12 |
# File 'lib/fb_util/fb_util_error.rb', line 4 def initialize(error_code, body) @error_code = error_code @body = body begin @object = JSON.parse(body) rescue JSON::ParserError @object = {"error" => {"message" => "Response was not valid json. See the body for more information."}} end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
2 3 4 |
# File 'lib/fb_util/fb_util_error.rb', line 2 def body @body end |
#error_code ⇒ Object
Returns the value of attribute error_code.
2 3 4 |
# File 'lib/fb_util/fb_util_error.rb', line 2 def error_code @error_code end |
#object ⇒ Object
Returns the value of attribute object.
2 3 4 |
# File 'lib/fb_util/fb_util_error.rb', line 2 def object @object end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'lib/fb_util/fb_util_error.rb', line 14 def to_s "Response code: #{error_code} => #{body}" end |