Skip to content

Add additional exceptions for more informative errors #26

Closed
@obervinov

Description

@obervinov
  • if the number of input arguments does not match the template (or if index argument in template body is wrong: {3})
          "post_already_downloaded": {
              "text": "{0} The content of the post <b>{1}</b> has already been downloaded.\n{3} The download was skipped.",
              "args": [":construction:", "post_id", ":boxing_glove:"]
          }
    Traceback (most recent call last):
      File "/home/pyinstabot-downloader/app/src/bot.py", line 521, in <module>
        main()
      File "/home/pyinstabot-downloader/app/src/bot.py", line 517, in main
        telegram.launch_bot()
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telegram/telegram.py", line 202, in launch_bot
        self.telegram_bot.polling(
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 1104, in polling
        self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 1179, in __threaded_polling
        raise e
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 1141, in __threaded_polling
        self.worker_pool.raise_exceptions()
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/util.py", line 149, in raise_exceptions
        raise self.exception_info
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telebot/util.py", line 92, in run
        task(*args, **kwargs)
      File "/home/pyinstabot-downloader/app/src/bot.py", line 329, in process_one_post
        telegram.send_styled_message(
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/telegram/telegram.py", line 171, in send_styled_message
        text=self.messages.render_template(
      File "/home/pyinstabot-downloader/app/.venv/lib/python3.9/site-packages/messages/messages.py", line 91, in render_template
        return template['text'].format(*arguments)
    IndexError: Replacement index 3 out of range for positional args tuple

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions