kafka-python icon indicating copy to clipboard operation
kafka-python copied to clipboard

Improve Exception handling for NoBrokersAvailable / missing api_version parameter

Open FieteO opened this issue 3 years ago • 1 comments

When unsuccessfully trying to connect to a broker, there are multiple reasons of failure that all result in a NoBrokersAvailable exception.

  • when specifying someunavailabledomain.com as the bootstrap_servers the resulting exception will be NoBrokersAvailable (which is intuitive)
  • when not specifying an api_version, the resulting exception will also be NoBrokersAvailable

The second failure mode is actually not intuitive for me and judging from this SO question or this one, I am not the only one who is not able to guess that there is in fact a broker available, but the api_version is missing.

I think it would be great if there would me a more meaningful exception (like UnsupportedApiVersion) that is indicating to the user that the api version that he is requesting (as per the default value of this library) is not available/not supported by the Kafka he is trying to connect to.

FieteO avatar Jan 19 '23 13:01 FieteO

I think it would be great if there would me a more meaningful exception (like UnsupportedApiVersion) that is indicating to the user that the api version that he is requesting (as per the default value of this library) is not available/not supported by the Kafka he is trying to connect to.

There is no default api value of this library. However, I agree that it seems many folks are confused and never specify an api_version configuration.

dpkp avatar Feb 14 '25 20:02 dpkp