error logging

This commit is contained in:
Tomáš Mládek 2021-09-19 11:30:17 +02:00
parent c89777621a
commit e82fcd5d42

View file

@ -86,29 +86,11 @@ class KollagenBot:
msg="Exception while handling an update:", exc_info=context.error
)
# # traceback.format_exception returns the usual python message about an exception, but as a
# # list of strings rather than a single string, so we have to join them together.
# tb_list = traceback.format_exception(
# None, context.error, context.error.__traceback__
# )
# tb_string = "".join(tb_list)
# # Build the message with some markup and additional information about what happened.
# # You might need to add some logic to deal with messages longer than the 4096 character limit.
# update_str = update.to_dict() if isinstance(update, Update) else str(update)
# message = (
# f"An exception was raised while handling an update\n"
# f"<pre>update = {html.escape(json.dumps(update_str, indent=2, ensure_ascii=False))}"
# "</pre>\n\n"
# f"<pre>context.chat_data = {html.escape(str(context.chat_data))}</pre>\n\n"
# f"<pre>context.user_data = {html.escape(str(context.user_data))}</pre>\n\n"
# f"<pre>{html.escape(tb_string)}</pre>"
# )
# # Finally, send the message
# context.bot.send_message(
# chat_id=DEVELOPER_CHAT_ID, text=message, parse_mode=ParseMode.HTML
# )
if isinstance(update, Update):
if isinstance(context.error, subprocess.CalledProcessError):
update.message.reply_text(f"Something is fucked!\n{context.error.stderr.decode('utf-8')}")
else:
update.message.reply_text(f"Something is fucked!\n{context.error}")
def start_idle(self):
self.updater.start_polling()