-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Make error output more clear for too big uploads. #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…13 File too large http error message.
|
Please see the travis log |
|
Ok, I see, there is a lot of connections with this error handling part. Client code and unit tests expect a certain behavior. So I will think how I can eject 413 error message gentle way. |
|
@alateas That's not the point. The point is that you moved the part where |
|
Oh I'm sorry, you already fixed that 😄 |
|
Reason of moving block of http error handling( https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/utils/request.py#L191-L200 ) up is this block will never be executed. Because if we, for example, get a 502 http error, any way data will parsed in 187 line and json parsing will raise ValueError in 134 line, because it will not be real json. Any way my last fix was wrong too :) |
|
Can't you insert the check between the 200-209 check and the message parsing in the original file? It doesn't need the message. |
|
I can, but this check the similar with other http error checks at lines 191-200, will be strange to separate 413 http error check. |
|
@alateas I have a fix for your fix :-) |
|
@tsnoam Good news! Actually I have allowed maintainers edits, I rechecked it right now. |
|
I failed to push my commit. I wonder if I do something wrong. |
|
I I see this correctly. The way it is in the latest commit it will never raise an error if there is an error but not in one of the error codes. Shouldn't we add an at the bottom? |
|
Nevermind, it just fell off the screen. It looks good to me. |
|
@alateas thanks for your contribution. |
I have faced unclear error output('Invalid server response') when tried to send big audio ~ 200mb via bot.send_audio. It was hard to understand that now you can upload files up to 50 MB using telegram api. So my small fix makes error output more clear by doing two things: