Exception: Contentful::Management::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Contentful::Management::Error
- Defined in:
- lib/contentful/management/error.rb
Overview
All errors raised by the contentful gem are either instances of Contentful::Error or inherit from Contentful::Error
Direct Known Subclasses
AccessDenied, BadRequest, NotFound, ServerError, ServiceUnavailable, Unauthorized, UnparsableJson, UnparsableResource
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
-
.[](error_status_code) ⇒ Object
Shortcut for creating specialized error classes USAGE rescue Contentful::Error.
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
8 9 10 11 |
# File 'lib/contentful/management/error.rb', line 8 def initialize(response) @response = response super @response. end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/contentful/management/error.rb', line 6 def response @response end |
Class Method Details
.[](error_status_code) ⇒ Object
Shortcut for creating specialized error classes USAGE rescue Contentful::Error
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/contentful/management/error.rb', line 15 def self.[](error_status_code) case error_status_code when 404 NotFound when 400 BadRequest when 403 AccessDenied when 401 when 500 ServerError when 503 ServiceUnavailable else Error end end |