trinodb / trino-python-client

Python client for Trino
Apache License 2.0
307 stars 151 forks source link

Give Trino an exception type for connection errors #364

Closed bendemott closed 10 months ago

bendemott commented 1 year ago

Describe the feature

Wrap connection exceptions from underlying requests library with TrinoConnectionError (or example)

I don't want to include requests in my application to know when my Trino server connection has failed.

Example

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8081): 
    Max retries exceeded with url: /v1/statement (
        Caused by NewConnectionError(
            '<urllib3.connection.HTTPConnection object at 0x7efc0a320580>: 
                Failed to establish a new connection: [Errno 111] Connection refused'))

Describe alternatives you've considered

N/A

Are you willing to submit PR?

mdesmet commented 1 year ago

This is definitely useful. Are you still working on this?