Skip to content

Better documented pattern for plugins using startup() to prevent server startup #2624

@simonw

Description

@simonw

Currently suggests an assert, and that gives you an ugly traceback:

Here is an example that validates required plugin configuration. The server will fail to start and show an error if the validation check fails:
.. code-block:: python
@hookimpl
def startup(datasette):
config = datasette.plugin_config("my-plugin") or {}
assert (
"required-setting" in config
), "my-plugin requires setting required-setting"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions