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

Client exception handling improvements

Open oclyke opened this issue 6 months ago • 0 comments
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:

  1. They are hard to predict: I don't know where to find the documentation which will tell me what to expect.
  2. 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."))

oclyke avatar Apr 30 '25 02:04 oclyke