Skip to content

Commit

Permalink
Enhanced general error handling
Browse files Browse the repository at this point in the history
Dropped duplicated general error messaging.
  • Loading branch information
yaroslavyaroslav committed Feb 21, 2023
1 parent 41f7015 commit dba8c26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def exec_net_request(self, connect: http.client.HTTPSConnection):
try:
res = connect.getresponse()
data = res.read()
status = res.status
data_decoded = data.decode('utf-8')
connect.close()
completion = json.loads(data_decoded)['choices'][0]['text']
Expand All @@ -70,8 +71,7 @@ def exec_net_request(self, connect: http.client.HTTPSConnection):
return

except Exception as ex:
sublime.error_message("Error\n" + str(ex))
logging.exception("Exception: " + str(ex))
sublime.error_message(f"Server Error: {str(status)}\n{ex}")
return

def complete(self):
Expand Down

0 comments on commit dba8c26

Please sign in to comment.