mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
Merge pull request #671 from alateas/master
Make error output more clear for too big uploads.
This commit is contained in:
commit
45d4ea083d
1 changed files with 5 additions and 1 deletions
|
@ -186,7 +186,7 @@ class Request(object):
|
|||
try:
|
||||
message = self._parse(resp.data)
|
||||
except ValueError:
|
||||
raise NetworkError('Unknown HTTPError {0}'.format(resp.status))
|
||||
message = 'Unknown HTTPError'
|
||||
|
||||
if resp.status in (401, 403):
|
||||
raise Unauthorized(message)
|
||||
|
@ -194,6 +194,10 @@ class Request(object):
|
|||
raise BadRequest(message)
|
||||
elif resp.status == 404:
|
||||
raise InvalidToken()
|
||||
elif resp.status == 413:
|
||||
raise NetworkError('File too large. Check telegram api limits '
|
||||
'https://core.telegram.org/bots/api#senddocument')
|
||||
|
||||
elif resp.status == 502:
|
||||
raise NetworkError('Bad Gateway')
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue