Skip to content

Commit

Permalink
Do not show database name in Database Not Found error, refs #2359
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 21, 2024
1 parent 93534fd commit 6268611
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,9 +1617,7 @@ async def resolve_database(self, request):
try:
return self.get_database(route=database_route)
except KeyError:
raise DatabaseNotFound(
"Database not found: {}".format(database_route), database_route
)
raise DatabaseNotFound(database_route)

async def resolve_table(self, request):
db = await self.resolve_database(request)
Expand Down
4 changes: 2 additions & 2 deletions datasette/utils/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class NotFound(Base400):


class DatabaseNotFound(NotFound):
def __init__(self, message, database_name):
super().__init__(message)
def __init__(self, database_name):
self.database_name = database_name
super().__init__("Database not found")


class TableNotFound(NotFound):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def test_insert_rows(ds_write, return_rows):
{},
None,
404,
["Database not found: data2"],
["Database not found"],
),
(
"/data/docs2/-/insert",
Expand Down

0 comments on commit 6268611

Please # to comment.