Skip to content
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

bug: ungraceful exception handling when no store found #45

Closed
tobixen opened this issue Jul 30, 2021 · 2 comments
Closed

bug: ungraceful exception handling when no store found #45

tobixen opened this issue Jul 30, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@tobixen
Copy link

tobixen commented Jul 30, 2021

If credentials.json exists, but not store, I get a rather ugly traceback:

$ matrix-commander --listen
Could not find existing store directory anywhere. A new one will be created. It
will need to be verified. The store directory will be created in the directory
"store". Optionally, consider moving the persistent storage directory files
inside "store" into the directory "/home/tobias/.local/share/matrix-
commander/store" for a more consistent experience.
2021-07-30 12:48:32,436:    ERROR: matrix-commander: The program matrix-commander failed. Sorry. Here is the traceback.
2021-07-30 12:48:32,438:    ERROR: matrix-commander: Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/peewee.py", line 3080, in connect
    self._state.set_connection(self._connect())
  File "/usr/lib/python3.9/site-packages/peewee.py", line 3416, in _connect
    conn = sqlite3.connect(self.database, timeout=self._timeout,
sqlite3.OperationalError: unable to open database file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/matrix-commander", line 2982, in main_listen
    client, credentials = login_using_credentials_file(
  File "/usr/bin/matrix-commander", line 2561, in login_using_credentials_file
    client.restore_login(
  File "/usr/lib/python3.9/site-packages/nio/client/base_client.py", line 407, in restore_login
    self.load_store()
  File "/usr/lib/python3.9/site-packages/nio/client/base_client.py", line 374, in load_store
    self.store = self.config.store(
  File "<string>", line 8, in __init__
  File "/usr/lib/python3.9/site-packages/nio/store/database.py", line 640, in __post_init__
    super().__post_init__()
  File "/usr/lib/python3.9/site-packages/nio/store/database.py", line 115, in __post_init__
    self.database.connect()
  File "/usr/lib/python3.9/site-packages/peewee.py", line 3083, in connect
    self._initialize_connection(self._state.conn)
  File "/usr/lib/python3.9/site-packages/peewee.py", line 2917, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/usr/lib/python3.9/site-packages/peewee.py", line 190, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.9/site-packages/peewee.py", line 3080, in connect
    self._state.set_connection(self._connect())
  File "/usr/lib/python3.9/site-packages/peewee.py", line 3416, in _connect
    conn = sqlite3.connect(self.database, timeout=self._timeout,
peewee.OperationalError: unable to open database file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/matrix-commander", line 4028, in <module>
    asyncio.get_event_loop().run_until_complete(main_listen())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/bin/matrix-commander", line 3006, in main_listen
    if client:
UnboundLocalError: local variable 'client' referenced before assignment
@8go 8go added the bug Something isn't working label Aug 5, 2021
@8go
Copy link
Owner

8go commented Aug 5, 2021

Thank you @tobixen 👍

Thanks for logging this issue. I will have a look at this and fix it. Just give me some time. Be patient.

@8go
Copy link
Owner

8go commented May 18, 2022

Fixed in commit 915d53f
Better messages to the user.
In hind-sight it would have been better to create a separate --init option and to not mix "first send" with the setup of store and credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants