Exception: MagicAdmin::RequestError

Inherits:
MagicError
  • Object
show all
Defined in:
lib/magic-admin/errors.rb

Overview

RequestError Class

Instance Attribute Summary collapse

Attributes inherited from MagicError

#message

Instance Method Summary collapse

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(message, opt = {})
  super(message)
  @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_codeObject (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_codeObject (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_messageObject (readonly)

attribute reader for http response message



36
37
38
# File 'lib/magic-admin/errors.rb', line 36

def http_message
  @http_message
end

#http_methodObject (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_dataObject (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_paramsObject (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_responseObject (readonly)

attribute reader for http response



33
34
35
# File 'lib/magic-admin/errors.rb', line 33

def http_response
  @http_response
end

#http_statusObject (readonly)

attribute reader for http response status



27
28
29
# File 'lib/magic-admin/errors.rb', line 27

def http_status
  @http_status
end