fix(chat): add error handling for failed sending
This commit is contained in:
parent
25c9857c4c
commit
633e27946d
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()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user