Skip to content

Commit

Permalink
Fixed error message, closes #1816
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Sep 20, 2022
1 parent df851c1 commit cb1e093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion datasette/app.py
Expand Up @@ -295,7 +295,9 @@ def __init__(
# Validate those settings
for key in settings:
if key not in DEFAULT_SETTINGS:
raise StartupError("Invalid setting '{key}' in settings.json")
raise StartupError(
"Invalid setting '{}' in settings.json".format(key)
)
self._settings = dict(DEFAULT_SETTINGS, **(settings or {}))
self.renderers = {} # File extension -> (renderer, can_render) functions
self.version_note = version_note
Expand Down
3 changes: 2 additions & 1 deletion tests/test_config_dir.py
Expand Up @@ -86,8 +86,9 @@ def test_invalid_settings(config_dir):
json.dumps({"invalid": "invalid-setting"}), "utf-8"
)
try:
with pytest.raises(StartupError):
with pytest.raises(StartupError) as ex:
ds = Datasette([], config_dir=config_dir)
assert ex.value.args[0] == "Invalid setting 'invalid' in settings.json"
finally:
(config_dir / "settings.json").write_text(previous, "utf-8")

Expand Down

0 comments on commit cb1e093

Please sign in to comment.