488 err400 = True
489 return
490
491 except Exception as e:492 try:
493 try:
494 await query.message.edit(Messages.ERROR_TXT.format(e))
504 except:
505 pass
506 LOGGER.error(e)
507 except Exception as err:508 LOGGER.error(err)
509 await archive_msg.reply(err)
510
593 await update_uploaded(user_id, upload_count=sent_files)
594 try:
595 shutil.rmtree(f"{Config.DOWNLOAD_LOCATION}/{spl_data[1]}")
596 except Exception as e:597 await query.message.edit(Messages.ERROR_TXT.format(e))
598 await archive_msg.reply(Messages.ERROR_TXT.format(e))
599
If the except block catches a very general exception, it is likely to catch any unrelated errors too. Try to be more explicit about which exception(s) you're trying to catch.
If you need to catch every other exception, then mark it as intentional by
adding a # skipcq
comment.
try:
x = a / b
except Exception:
x = a / (b + 1)
try:
line = input('Enter numbers:')
numbers = [int(i) for i in line.split()]
except BaseException:
print('Only use numbers for the input')
try:
x = a / b
except ZeroDivisionError:
x = a / (b + 1)
try:
event_loop.run()
except Exception as exc: # skipcq: PYL-W0703 - Loop can sometimes crash.
sentry.report(exc)
try:
line = input('Enter numbers:')
numbers = [int(i) for i in line.split()]
except ValueError:
print('Only use numbers for the input')