Catch thread exception
chri-hub opened this issue · 0 comments
chri-hub commented
Hi there,
i'm running a MessageLoop as thread. The Bot works fine, but i'm not able to catch an exception.
If an error occurs in the thread, i can't handle it in my program (e.g. the APIKEY is invalid).
Thanks
try:
bot = telepot.DelegatorBot(APIKEY, [
include_callback_query_chat_id(
pave_event_space())(
per_chat_id(types=['private']), create_open, ChatBot, timeout=10),
])
MessageLoop(bot).run_as_thread()
print('Listening ...')
while 1:
time.sleep(10)
except Exception as ex:
print('Exception')
... some exception handling ...