mirror of
https://github.com/simonw/datasette.git
synced 2026-06-15 05:26:59 +02:00
datasette.utils.StartupError() now becomes a click exception, closes #2624
This commit is contained in:
parent
6fede23a2e
commit
757ce92baf
3 changed files with 39 additions and 5 deletions
|
|
@ -666,7 +666,10 @@ def serve(
|
|||
return ds
|
||||
|
||||
# Run the "startup" plugin hooks
|
||||
run_sync(ds.invoke_startup)
|
||||
try:
|
||||
run_sync(ds.invoke_startup)
|
||||
except StartupError as e:
|
||||
raise click.ClickException(e.args[0])
|
||||
|
||||
# Run async soundness checks - but only if we're not under pytest
|
||||
run_sync(lambda: check_databases(ds))
|
||||
|
|
@ -815,7 +818,10 @@ def create_token(
|
|||
ds = Datasette(secret=secret, plugins_dir=plugins_dir)
|
||||
|
||||
# Run ds.invoke_startup() in an event loop
|
||||
run_sync(ds.invoke_startup)
|
||||
try:
|
||||
run_sync(ds.invoke_startup)
|
||||
except StartupError as e:
|
||||
raise click.ClickException(e.args[0])
|
||||
|
||||
# Warn about any unknown actions
|
||||
actions = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue