228 progress(d, t, v_url, c_time, "Uploading..",
229 f"{ytdl_data_name_video}")))
230 # os.remove(thumb)
231 except Exception as e:232 await v_url.client.send_message(
233 v_url.chat_id,
234 "{} caused `{}`".format(caption_rts, str(e)),
172 progress(d, v_url, c_time, "Uploading..",
173 f"{ytdl_data_name_audio}")))
174 # os.remove(thumb)
175 except Exception as e:176 await v_url.client.send_message(
177 v_url.chat_id,
178 "{} caused `{}`".format(caption_rts, str(e)),
108 else:
109 await event.edit("File Downloaded Successfully: `{}`".format(file.name))
110 return
111 except Exception as e:112 if " not found" in str(e) or "'file'" in str(e):
113 await event.edit("Download Canceled :\n`{}`".format(file.name))
114 return
62 )
63 await event.edit(msg)
64 await asyncio.sleep(10)
65 except Exception as e: 66 pass
67
68 await event.edit("**File Downloaded Successfully:** `{}`".format(file.name))
33 # Add URL Into Queue
34 try:
35 download = aria2.add_uris(uris, options=None, position=None)
36 except Exception as e: 37 # await event.edit("`Error:\n`"+str(e))
38 return
39 gid = download.gid
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')