influxdb3-python
influxdb3-python copied to clipboard
Client exception handling improvements
trafficstars
Right now I am finding (the hard way) that my calls, such as query_async, may result in an exception from pyarrow such as "pyarrow._flight.FlightInternalError". These exceptions are really hard to use, as a consumer of the API. There are two problems:
- They are hard to predict: I don't know where to find the documentation which will tell me what to expect.
- They are hard to react to: not only do I need to now know about pyarrow but I need to implement some parsing for an "InternalError" of some other module.
Arguably the second issue is a bigger problem for me, but the first is tough too.
Proposed solution is that methods such as write, query, and query_async handle these internal exceptions themselves and, when appropriate, raise a well-defined exception to the consumer (e.g. raise InfluxDBClient3NotFoundException(f"No database with the name '{database}' exists on the server."))