9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/seko_ecom_api/client.rb', line 9
def handle_response(response)
error_message = response.body
case response.status
when 400
raise Error, "A bad request or a validation exception has occurred. #{error_message}"
when 401
raise Error, "Invalid authorization credentials. #{error_message}"
when 403
raise Error, "Connection doesn't have permission to access the resource. #{error_message}"
when 404
raise Error, "The resource you have specified cannot be found. #{error_message}"
when 429
raise Error, "The API rate limit for your application has been exceeded. #{error_message}"
when 500
raise Error,
"An unhandled error with the . Contact the Seko Ecom API team if problems persist. #{error_message}"
when 503
raise Error,
"API is currently unavailable – typically due to a scheduled outage – try again soon. #{error_message}"
end
response
end
|