mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Add a clearer error in case of bad file ids
This commit is contained in:
parent
a0e0cbe477
commit
9f77fed181
1 changed files with 5 additions and 1 deletions
|
|
@ -52,7 +52,11 @@ def get_input_media_from_file_id(
|
||||||
file_id: str,
|
file_id: str,
|
||||||
expected_file_type: FileType = None
|
expected_file_type: FileType = None
|
||||||
) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]:
|
) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]:
|
||||||
decoded = FileId.decode(file_id)
|
try:
|
||||||
|
decoded = FileId.decode(file_id)
|
||||||
|
except Exception:
|
||||||
|
raise ValueError(f'Failed to decode "{file_id}". The value does not represent an existing local file, '
|
||||||
|
f'HTTP URL, or valid file id.')
|
||||||
|
|
||||||
file_type = decoded.file_type
|
file_type = decoded.file_type
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue