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

fix: Improve error message for SQLitePersister #417

Open
zilto opened this issue Nov 6, 2024 · 4 comments
Open

fix: Improve error message for SQLitePersister #417

zilto opened this issue Nov 6, 2024 · 4 comments
Labels
exceptions Improvements to exception handling and provide clearer messages to users good first issue Good for newcomers

Comments

@zilto
Copy link
Collaborator

zilto commented Nov 6, 2024

I always forget about calling .initialize() on the persister to create tables and that's the error I get:

  File .../assistant.py", line 86, in build_assistant
    .build()
     ^^^^^^^
  File ".../burr/telemetry.py", line 276, in wrapped_fn
    return call_fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../application.py", line 2333, in build
    self._load_from_persister()
  File ".../burr/core/application.py", line 2262, in _load_from_persister
    load_result = self.initializer.load(_partition_key, _app_id, _sequence_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../burr/core/persistence.py", line 242, in load
    cursor.execute(
sqlite3.OperationalError: no such table: burr_state

Notes:

  • it's a bit odd that the stack trace bounces between user code -> burr.telemetry -> user code -> burr.core.persistence
  • could catch the uninitialized persister at ApplicationBuilder().with_state_persistence(...) instead of ApplicationBuilder().build(). (seems like a unlikely pattern to pass the persister then initialize it later)
  • error message should say RuntimeError: Uninitialized persister. Make sure to call .initialize() before passing it to the ApplicationBuilder
@zilto zilto added good first issue Good for newcomers exceptions Improvements to exception handling and provide clearer messages to users labels Nov 6, 2024
@ghost
Copy link

ghost commented Nov 8, 2024

@zilto can I take it up?

@zilto
Copy link
Collaborator Author

zilto commented Nov 8, 2024

@arpitgupta-it Yes, you can work on it! Do you have any question? The goal is to catch more explicitly the missing table when calling self.initializer.load(...) and raise an appropriate error message

@ghost
Copy link

ghost commented Nov 8, 2024

I just raised a PR. Please review if it looks good to approve or any changes.

@skrawcz
Copy link
Contributor

skrawcz commented Nov 8, 2024

@arpitgupta-it thanks I just added comments. We need to extend it to cover all persisters and maintain backwards compatibility with custom persisters people may have written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exceptions Improvements to exception handling and provide clearer messages to users good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants