Skip to content

Commit a4e3e1c

Browse files
fix: raise error instead of swallowing it in handle_download() (#310)
users choice best of 2026
1 parent e5f0216 commit a4e3e1c

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

pyrogram/client.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,13 +1095,10 @@ async def handle_download(self, packet):
10951095
file.close()
10961096
os.remove(temp_file_path)
10971097

1098-
if isinstance(e, asyncio.CancelledError):
1099-
raise e
1100-
1101-
if isinstance(e, (FloodWait, FloodPremiumWait)):
1102-
raise e
1098+
if isinstance(e, pyrogram.StopTransmission):
1099+
return None
11031100

1104-
return None
1101+
raise e
11051102
else:
11061103
if in_memory:
11071104
file.name = file_name
@@ -1296,12 +1293,8 @@ def _check_all_hashes():
12961293
raise e
12971294
finally:
12981295
await cdn_session.stop()
1299-
except pyrogram.StopTransmission:
1300-
raise
1301-
except (FloodWait, FloodPremiumWait):
1302-
raise
13031296
except Exception as e:
1304-
log.exception(e)
1297+
raise e
13051298

13061299
async def get_session(
13071300
self,

0 commit comments

Comments
 (0)