Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API
https://python-tgpt.onrender.com
MIT License
106 stars 15 forks source link

Exit code when no network available or similar errors #5

Closed sameedzahoor closed 9 months ago

sameedzahoor commented 9 months ago

I was trying tgpt today and encountered the following error as my wifi was off.

10:20:19 - ERROR : HTTPSConnectionPool(host='ai-chat.bsg.brave.com', port=443): Max retries exceeded with url: /v1/complete (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x8f61dd59rcd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

When such an error occurs (when host can’t be reached) tgpt should not return an exit code of 0. This affected a script it was being used in.

Simatwa commented 9 months ago

Awesome.