RedHatInsights / insights-api-common-rails

Header, Encryption, RBAC, Serialization, Pagination and other common behavior for Insights microservices built with Rails
Apache License 2.0
3 stars 25 forks source link

Separate RBAC network error out from common errors #163

Closed hsong-rh closed 4 years ago

hsong-rh commented 4 years ago

The Auto Generated clients use libcurl to perform network operations. lib curl can detect

  1. Connection failures (bad host, not reachable)
  2. Timeout errors
  3. Actual HTTP status codes coming from the API Server

https://github.com/RedHatInsights/insights-rbac-api-client-ruby/blob/41cddab91c06ef34abec537a8c83e08ca4a8d2be/lib/rbac-api-client/api_client.rb#L56

This PR adds the ability to make distinctions between Network Error, Time out error and actual API errors which allows the services to respond with appropriate HTTP error codes when communication between services fails (e.g. Catalog talking to RBAC service and the RBAC service is down)