[Crash] except other Telegram API error codes #42

Closed
opened 2019-06-10 09:41:44 +00:00 by b3yond · 2 comments

Author: @b3yond Posted at: 06.10.2018 07:06

The bot crashed with this traceback:

Shutdown.
Traceback (most recent call last):
  File "backend.py", line 37, in <module>
    reports = bot.crawl(user)
  File "/srv/ticketfrei/active_bots/telegrambot.py", line 25, in crawl
    user.save_seen_tg(update.update_id)
AttributeError: 'int' object has no attribute 'update_id'

sometimes the Telegram API returns an error code as an integer. update is something like 404 in this case. Yet, we only except the error code 404, which Telegram also uses for bad auth. I thought they were too lazy to use different ones. But probably we just ran in another error code. a shame that it isn't included in the traceback.

@git-sid

Author: @b3yond Posted at: 06.10.2018 07:06 The bot crashed with this traceback: ``` Shutdown. Traceback (most recent call last): File "backend.py", line 37, in <module> reports = bot.crawl(user) File "/srv/ticketfrei/active_bots/telegrambot.py", line 25, in crawl user.save_seen_tg(update.update_id) AttributeError: 'int' object has no attribute 'update_id' ``` sometimes the Telegram API returns an error code as an integer. update is something like 404 in this case. Yet, we only except the error code 404, which Telegram also uses for bad auth. I thought they were too lazy to use different ones. But probably we just ran in another error code. a shame that it isn't included in the traceback. @git-sid
b3yond added the
bug
label 2019-06-10 09:41:44 +00:00

Author: @b3yond Posted at: 06.10.2018 07:10

Here is a list of Telegram API return error codes: https://core.telegram.org/api/errors

we could think about all those error codes and implement them correctly, or just look if update is an integer and return an empy mentions list.

Author: @b3yond Posted at: 06.10.2018 07:10 Here is a list of Telegram API return error codes: https://core.telegram.org/api/errors we could think about all those error codes and implement them correctly, or just look if update is an integer and return an empy mentions list.

Author: @b3yond Posted at: 07.10.2018 17:10

This can not really be tested - we don't control the Telegram API. At least, when new error codes appear, they are logged now.

Author: @b3yond Posted at: 07.10.2018 17:10 This can not really be tested - we don't control the Telegram API. At least, when new error codes appear, they are logged now.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: juergen/ticketfrei#42
There is no content yet.