fix(chat): add error handling for failed sending
This commit is contained in:
5
bot.py
5
bot.py
@@ -142,7 +142,10 @@ class Bot:
|
|||||||
|
|
||||||
# Write response
|
# Write response
|
||||||
# Truncate response if too long
|
# 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()
|
task.cancel()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user