Exception: MagicAdmin::RequestError
- Inherits:
-
MagicError
- Object
- StandardError
- MagicError
- MagicAdmin::RequestError
- Defined in:
- lib/magic-admin/errors.rb
Overview
RequestError Class
Direct Known Subclasses
APIConnectionError, APIError, AuthenticationError, BadRequestError, ForbiddenError, RateLimitingError
Instance Attribute Summary collapse
-
#http_code ⇒ Object
readonly
attribute reader for http response code.
-
#http_error_code ⇒ Object
readonly
attribute reader for http response error code.
-
#http_message ⇒ Object
readonly
attribute reader for http response message.
-
#http_method ⇒ Object
readonly
attribute reader for http request method.
-
#http_request_data ⇒ Object
readonly
attribute reader for http request data.
-
#http_request_params ⇒ Object
readonly
attribute reader for http request params.
-
#http_response ⇒ Object
readonly
attribute reader for http response.
-
#http_status ⇒ Object
readonly
attribute reader for http response status.
Attributes inherited from MagicError
Instance Method Summary collapse
-
#initialize(message, opt = {}) ⇒ RequestError
constructor
Description: The constructor allows you to specify error message and HTTP request and response info.
Constructor Details
#initialize(message, opt = {}) ⇒ RequestError
Description:
The constructor allows you to specify error message
and HTTP request and response info
Arguments:
message: request error message.
opt: hash of request and response info of following keys:
http_status
http_code
http_response
http_message
http_error_code
http_request_params
http_request_data
http_method
Returns:
A Error object that provides additional error info for magic api call.
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/magic-admin/errors.rb', line 67 def initialize(, opt = {}) super() @http_status = opt[:http_status] @http_code = opt[:http_code] @http_response = opt[:http_response] @http_message = opt[:http_message] @http_error_code = opt[:http_error_code] @http_request_params = opt[:http_request_params] @http_request_data = opt[:http_request_data] @http_method = opt[:http_method] end |
Instance Attribute Details
#http_code ⇒ Object (readonly)
attribute reader for http response code
30 31 32 |
# File 'lib/magic-admin/errors.rb', line 30 def http_code @http_code end |
#http_error_code ⇒ Object (readonly)
attribute reader for http response error code
39 40 41 |
# File 'lib/magic-admin/errors.rb', line 39 def http_error_code @http_error_code end |
#http_message ⇒ Object (readonly)
attribute reader for http response message
36 37 38 |
# File 'lib/magic-admin/errors.rb', line 36 def @http_message end |
#http_method ⇒ Object (readonly)
attribute reader for http request method
48 49 50 |
# File 'lib/magic-admin/errors.rb', line 48 def http_method @http_method end |
#http_request_data ⇒ Object (readonly)
attribute reader for http request data
45 46 47 |
# File 'lib/magic-admin/errors.rb', line 45 def http_request_data @http_request_data end |
#http_request_params ⇒ Object (readonly)
attribute reader for http request params
42 43 44 |
# File 'lib/magic-admin/errors.rb', line 42 def http_request_params @http_request_params end |
#http_response ⇒ Object (readonly)
attribute reader for http response
33 34 35 |
# File 'lib/magic-admin/errors.rb', line 33 def http_response @http_response end |
#http_status ⇒ Object (readonly)
attribute reader for http response status
27 28 29 |
# File 'lib/magic-admin/errors.rb', line 27 def http_status @http_status end |