From f37967ba7472d0cab4afeda3cc946ac244a3164e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Thu, 18 Jul 2024 18:46:56 +0200 Subject: [PATCH] Better hash format error message (#1442) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- jupyter_server/services/contents/handlers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jupyter_server/services/contents/handlers.py b/jupyter_server/services/contents/handlers.py index ad25a2d3f7..13e987809b 100644 --- a/jupyter_server/services/contents/handlers.py +++ b/jupyter_server/services/contents/handlers.py @@ -140,7 +140,9 @@ async def get(self, path=""): hash_str = self.get_query_argument("hash", default="0") if hash_str not in {"0", "1"}: - raise web.HTTPError(400, f"Content {hash_str!r} is invalid") + raise web.HTTPError( + 400, f"Hash argument {hash_str!r} is invalid. It must be '0' or '1'." + ) require_hash = int(hash_str) if not cm.allow_hidden and await ensure_async(cm.is_hidden(path)):