Skip to content

Commit

Permalink
fix(chat): add error handling for failed sending
Browse files Browse the repository at this point in the history
  • Loading branch information
The0mikkel committed May 28, 2024
1 parent 25c9857 commit 633e279
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ async def on_message(self, message):

# Write response
# Truncate response if too long
await r.write(message, response[:2000])
try:
await r.write(message, response[:2000])
except Exception as e:
logging.error('Error sending response: %s', e)
task.cancel()


Expand Down

0 comments on commit 633e279

Please sign in to comment.