Exception: Fanforce::API::ServerError
- Inherits:
-
Error
- Object
- StandardError
- Error
- Fanforce::API::ServerError
show all
- Defined in:
- lib/fanforce/api/error.rb
Instance Attribute Summary
Attributes inherited from Error
#errors, #request, #requested_params, #requested_url, #response
Instance Method Summary
collapse
Methods inherited from Error
#to_s
Constructor Details
#initialize(response, request, requested_url, requested_params) ⇒ ServerError
Returns a new instance of ServerError.
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fanforce/api/error.rb', line 27
def initialize(response, request, requested_url, requested_params)
@response_body = response.to_s
begin
@response_hash = Fanforce::Utils.decode_json(response)
@errors = @response_hash[:errors]
rescue Exception => e
raise Fanforce::API::DecodingError.new(e, response, request, requested_url, requested_params)
end
super(response.to_s, response, request, requested_url, requested_params)
end
|
Instance Method Details
#code ⇒ Object
49
|
# File 'lib/fanforce/api/error.rb', line 49
def code; @response.code end
|
#curl_command ⇒ Object
44
45
46
47
|
# File 'lib/fanforce/api/error.rb', line 44
def curl_command
method = begin @request.method rescue nil end
Fanforce::Utils.curl_command(method, @requested_url, @requested_params)
end
|
#to_hash ⇒ Object
40
41
42
|
# File 'lib/fanforce/api/error.rb', line 40
def to_hash
@response_hash
end
|