Aiven-Open / karapace

Karapace - Your Apache Kafka® essentials in one tool
https://karapace.io
Apache License 2.0
450 stars 68 forks source link

rapu: catch `aiohttp.ClientError` with a `503` response status #896

Closed nosahama closed 2 months ago

nosahama commented 3 months ago

About this change - What it does

This catches aiohttp.ClientError and returns HTTPStatus<503> rather than HTTPStatus<500>. We also catch the base aiohttp.ClientError rather than just aiohttp.ClientConnectorError, as for us, most client errors will also be TCP connection related, rather than actual invalid request data, etc and we include the exception information with the logged message, this can further aid debugging.

References: HH-3866

Why this way

Reflects properly the behaviour of the server via the response status.