8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/jirafe/response_parser.rb', line 8
def check_response_for_exception(response)
return if (200..399).include?(response.code) exception = case response.code.to_i
when 400 Jirafe::Error::BadRequest
when 401
Jirafe::Error::Unauthorized
when 403
Jirafe::Error::Forbidden
when 404
Jirafe::Error::ResourceNotFound
when 405
Jirafe::Error::NotAllowed
when 500
Jirafe::Error::ServerError
else
Jirafe::Error::UnknownError
end
raise exception.new(response)
end
|