Skip to content

Commit

Permalink
feat: include exception type in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
y-young committed Nov 21, 2022
1 parent 1f0fbe0 commit d9a2d5c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nazurin/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ async def on_error(update: Update, exception: Exception):
logger.error('Update %s caused %s: %s', update, type(error), error)
traceback.print_exc()
if not isinstance(error, TelegramAPIError):
await update.message.reply('Error: ' +
escape(str(error), quote=False))
error_type = type(error).__name__
error_msg = escape(str(error), quote=False)
await update.message.reply(f'Error: ({error_type}) {error_msg}')

return True

def main():
Expand Down

0 comments on commit d9a2d5c

Please sign in to comment.