Improve Exception handling for NoBrokersAvailable / missing api_version parameter
When unsuccessfully trying to connect to a broker, there are multiple reasons of failure that all result in a NoBrokersAvailable exception.
- when specifying
someunavailabledomain.comas thebootstrap_serversthe resulting exception will beNoBrokersAvailable(which is intuitive) - when not specifying an
api_version, the resulting exception will also beNoBrokersAvailable
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.
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.