3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/servicenow/http_errors.rb', line 3
def on_complete(env)
case env[:status].to_i
when 400
raise BadRequestError, env.response
when 401
raise UnauthorizedError, env.response
when 403
raise ForbiddenError, env.response
when 404
raise NotFoundError, env.response
when 405
raise MethodNotAllowedError, env.response
when 406
raise NotAcceptableError, env.response
when 415
raise UnsupportedMediaTypeError, env.response
when 500..600
raise ApiError, env.response
end
end
|