diff --git a/pyrogram/client/methods/download_media.py b/pyrogram/client/methods/download_media.py index 20179d08..e2fd463f 100644 --- a/pyrogram/client/methods/download_media.py +++ b/pyrogram/client/methods/download_media.py @@ -75,6 +75,8 @@ class DownloadMedia(BaseClient): Raises: :class:`Error ` """ + error_message = "This message doesn't contain any downloadable media" + if isinstance(message, pyrogram_types.Message): if message.photo: media = pyrogram_types.Document( @@ -98,7 +100,7 @@ class DownloadMedia(BaseClient): elif message.gif: media = message.gif else: - return + raise ValueError(error_message) elif isinstance(message, ( pyrogram_types.Photo, pyrogram_types.PhotoSize, @@ -126,7 +128,7 @@ class DownloadMedia(BaseClient): mime_type="" ) else: - return + raise ValueError(error_message) done = Event() path = [None]