Class: K8y::REST::RequestWrapper
- Inherits:
-
Object
- Object
- K8y::REST::RequestWrapper
- Defined in:
- lib/k8y/rest/request_wrapper.rb
Instance Method Summary collapse
Instance Method Details
#handle(exception, retry_unauthorized: false) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/k8y/rest/request_wrapper.rb', line 6 def handle(exception, retry_unauthorized: false) code = exception.response_status if code == 401 && raise RetriableUnauthorizedError, exception elsif code == 401 raise UnauthorizedError, exception elsif code == 404 raise NotFoundError, exception elsif code >= 500 raise ServerError, exception else raise HTTPError, exception end end |