nkgilley / python-ecobee-api

Python API for controlling Ecobee Thermostats
MIT License
44 stars 40 forks source link

Add additional info to error log when catching RequestException. #66

Closed bjpetit closed 3 years ago

bjpetit commented 3 years ago

RequestException is a catch-all exception thrown from the request() call. Adding additional exception detail, for this exception, to error logging to help with debugging.

This additional detail would have pointed me at the issue when I was trying to figure out what was failing here #61

For example, for a DNS issue, the logs would show something like this...

2021-03-24 23:45:15 ERROR (SyncWorker_4) [pyecobee] Error connecting to ecobee while attempting to refresh tokens. Possible connectivity outage.
HTTPSConnectionPool(host='apii.ecobee.com', port=443): Max retries exceeded with url: /token?grant_type=refresh_token&refresh_token=BMVJfu1j1YpRxWN39-vm5_0-fAWOIFbf5XTV-6i7_Dbx8&client_id=DSj7G6hVqnwELobA7C9VMxHDqZZRK7I6 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10e1a85b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
nkgilley commented 3 years ago

Thanks!