Exception: Chatrix::ApiError
- Inherits:
-
ChatrixError
- Object
- StandardError
- ChatrixError
- Chatrix::ApiError
- Defined in:
- lib/chatrix/errors.rb
Overview
Errors that stem from an API call.
Direct Known Subclasses
AuthenticationError, ForbiddenError, NotFoundError, RateLimitError, RequestError
Instance Attribute Summary collapse
-
#api_message ⇒ String
readonly
The error message returned from the server.
-
#code ⇒ String
readonly
The type of error.
-
#error ⇒ Hash
readonly
The raw error response object.
Instance Method Summary collapse
-
#initialize(error = {}) ⇒ ApiError
constructor
Initializes a new RequestError instance.
Constructor Details
#initialize(error = {}) ⇒ ApiError
Initializes a new RequestError instance.
24 25 26 27 28 |
# File 'lib/chatrix/errors.rb', line 24 def initialize(error = {}) @error = error @code = error['errcode'] || 'E_UNKNOWN' @api_message = error['error'] || 'Unknown error' end |
Instance Attribute Details
#api_message ⇒ String (readonly)
Returns the error message returned from the server.
'Unknown error'
if the server did not give any message.
20 21 22 |
# File 'lib/chatrix/errors.rb', line 20 def @api_message end |
#code ⇒ String (readonly)
Returns the type of error. 'E_UNKNOWN'
if the server
did not give an error code.
16 17 18 |
# File 'lib/chatrix/errors.rb', line 16 def code @code end |
#error ⇒ Hash (readonly)
Returns the raw error response object.
12 13 14 |
# File 'lib/chatrix/errors.rb', line 12 def error @error end |