Exception: VoiceML::ApiError
- Defined in:
- lib/voiceml/errors.rb
Overview
Raised when the API returns a non-2xx response.
The Twilio-compatible error body ({ code, message, more_info, status }) is parsed into
#code, #message, and #more_info when present, with the raw payload exposed on
#body. #more_info is the Twilio documentation URL for the error code (e.g.
https://www.twilio.com/docs/errors/20404).
Direct Known Subclasses
AuthenticationError, BadRequestError, ConflictError, GoneError, NotFoundError, NotImplementedAPIError, PermissionDeniedError, RateLimitError, ServerError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#more_info ⇒ Object
readonly
Returns the value of attribute more_info.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message, status_code:, code: nil, body: nil, more_info: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message, status_code:, code: nil, body: nil, more_info: nil) ⇒ ApiError
Returns a new instance of ApiError.
19 20 21 22 23 24 25 |
# File 'lib/voiceml/errors.rb', line 19 def initialize(, status_code:, code: nil, body: nil, more_info: nil) super() @status_code = status_code @code = code @body = body @more_info = more_info end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
17 18 19 |
# File 'lib/voiceml/errors.rb', line 17 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/voiceml/errors.rb', line 17 def code @code end |
#more_info ⇒ Object (readonly)
Returns the value of attribute more_info.
17 18 19 |
# File 'lib/voiceml/errors.rb', line 17 def more_info @more_info end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
17 18 19 |
# File 'lib/voiceml/errors.rb', line 17 def status_code @status_code end |