Skip to content

Commit 45d4ea0

Browse files
authored
Merge pull request python-telegram-bot#671 from alateas/master
Make error output more clear for too big uploads.
2 parents 4b3b0cb + 7a89dcb commit 45d4ea0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

telegram/utils/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,18 @@ def _request_wrapper(self, *args, **kwargs):
186186
try:
187187
message = self._parse(resp.data)
188188
except ValueError:
189-
raise NetworkError('Unknown HTTPError {0}'.format(resp.status))
189+
message = 'Unknown HTTPError'
190190

191191
if resp.status in (401, 403):
192192
raise Unauthorized(message)
193193
elif resp.status == 400:
194194
raise BadRequest(message)
195195
elif resp.status == 404:
196196
raise InvalidToken()
197+
elif resp.status == 413:
198+
raise NetworkError('File too large. Check telegram api limits '
199+
'https://core.telegram.org/bots/api#senddocument')
200+
197201
elif resp.status == 502:
198202
raise NetworkError('Bad Gateway')
199203
else:

0 commit comments

Comments
 (0)