8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/evervault/errors/legacy_error_map.rb', line 8
def self.raise_errors_on_failure(status_code, body, )
return if status_code < 400
case status_code
when 404
raise EvervaultError, 'Resource not found'
when 400
raise EvervaultError, 'Bad request'
when 401
raise EvervaultError, 'Unauthorized'
when 403
if (.include? 'x-evervault-error-code') && (['x-evervault-error-code'] == 'forbidden-ip-error')
raise ForbiddenIPError, 'IP is not present in Cage whitelist'
end
raise EvervaultError, 'Forbidden'
when 500
raise EvervaultError, 'Server error'
when 502
raise EvervaultError, 'Bad gateway error'
when 503
raise EvervaultError, 'Service unavailable'
else
raise EvervaultError, message_for_unexpected_error_without_type(body)
end
end
|