Exception: AdobeDocApi::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/adobe_doc_api/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code:, msg:) ⇒ Error

Returns a new instance of Error.



6
7
8
9
10
# File 'lib/adobe_doc_api/error.rb', line 6

def initialize(status_code:, msg:)
  super
  @status_code = status_code
  @msg = msg
end

Instance Attribute Details

#status_codeObject (readonly)

Returns the value of attribute status_code.



4
5
6
# File 'lib/adobe_doc_api/error.rb', line 4

def status_code
  @status_code
end

Instance Method Details

#messageObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/adobe_doc_api/error.rb', line 12

def message
  case @status_code
  when 200 then "The operation has failed due to some reason before the wait time provided in the Prefer header specified in the request (if Prefer header was not specified then the wait time is 59s by default), for detailed error refer cpf:status field inside the response body. Expect 200 HTTP status code only when respond-async,wait=0 is NOT specified in the Prefer Header value while creating the request. Refer the response body structure from GET call 200 response."
  when 201 then "The operation is completed successfully before the wait time provided in the Prefer header specified in the request (if Prefer header was not specified then the wait time is 59s by default). Expect 201 HTTP status code only when respond-async,wait=0 is NOT specified in the Prefer Header value while creating the request. Refer the response body structure from GET call 200 response."
  when 400 then "#{@msg["title"]} : #{@msg["report"]["error_code"]}"
  when 408 then "Request Timed Out. Some operation has timed out due to client issue."
  when 429 then "Caller doesn't have sufficient quota for this operation."
  when 500 then "Internal Server Error. The server has encountered an error and is unable to process your request at this time."
  else
    @msg
  end
end