Skip to content

KeyError exception with 'session' after restaring the server #10

@davafons

Description

@davafons

Expected Behavior

After the server is restarted, one should be able to use the menu buttons from old messages without errors.

Actual Behavior

After the server is restarted, when a user clicks on any button, an exception will be generated indicating that the session key doesn't exists. The user must explicitly use the /start command in order to generate a new session.

2019-06-21 16:06:57,664 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
Traceback (most recent call last):
  File "/home/david/cmsysbot-telegram/venv/lib/python3.6/site-packages/telegram/ext/dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "/home/david/cmsysbot-telegram/venv/lib/python3.6/site-packages/telegram/ext/callbackqueryhandler.py", line 143, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "/home/david/cmsysbot-telegram/cmsysbot/controller/general.py", line 75, in disconnect
    bridge_ip = user_data["session"].bridge_ip
KeyError: 'session'

Steps to Reproduce the Problem

  1. Start the bot server.
  2. Use the /start command on the chat. The main menu should appear.
  3. Shutdown and restart the server.
  4. Now, try to press any button on the menu (without using /start again). An exception should pop on the console log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions