Exception: Audd::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/audd/errors.rb

Overview

The server answered with status: "error". Carries the AudD error code plus the server's full echo of the request, which is what AudD support asks for.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_code:, error_message:, http_status: nil, request_id: nil, request_params: {}, request_method: nil, branded_message: nil, raw_response: nil) ⇒ ApiError

Returns a new instance of ApiError.



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/audd/errors.rb', line 42

def initialize(error_code:, error_message:, http_status: nil, request_id: nil,
  request_params: {}, request_method: nil, branded_message: nil, raw_response: nil)
  @error_code = error_code
  @error_message = error_message
  @http_status = http_status
  @request_id = request_id
  @request_params = request_params || {}
  @request_method = request_method
  @branded_message = branded_message
  @raw_response = raw_response
  super("[##{error_code}] #{error_message}")
end

Instance Attribute Details

#branded_messageObject (readonly)

Returns the value of attribute branded_message.



39
40
41
# File 'lib/audd/errors.rb', line 39

def branded_message
  @branded_message
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



39
40
41
# File 'lib/audd/errors.rb', line 39

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



39
40
41
# File 'lib/audd/errors.rb', line 39

def error_message
  @error_message
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



39
40
41
# File 'lib/audd/errors.rb', line 39

def http_status
  @http_status
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



39
40
41
# File 'lib/audd/errors.rb', line 39

def raw_response
  @raw_response
end

#request_idObject (readonly)

Returns the value of attribute request_id.



39
40
41
# File 'lib/audd/errors.rb', line 39

def request_id
  @request_id
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



39
40
41
# File 'lib/audd/errors.rb', line 39

def request_method
  @request_method
end

#request_paramsObject (readonly)

Returns the value of attribute request_params.



39
40
41
# File 'lib/audd/errors.rb', line 39

def request_params
  @request_params
end