From b320ce7fa5c58eeea3d63dd7a7567ed95330ea30 Mon Sep 17 00:00:00 2001 From: jstzwj <1103870790@qq.com> Date: Fri, 6 Sep 2024 21:49:47 +0800 Subject: [PATCH] update --- olah/errors.py | 11 ++++++++--- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/olah/errors.py b/olah/errors.py index 7bb8b24..2d741c3 100644 --- a/olah/errors.py +++ b/olah/errors.py @@ -22,7 +22,7 @@ def error_repo_not_found() -> JSONResponse: def error_page_not_found() -> JSONResponse: return JSONResponse( - content={"error":"Sorry, we can't find the page you are looking for."}, + content={"error": "Sorry, we can't find the page you are looking for."}, headers={ "x-error-code": "RepoNotFound", "x-error-message": "Sorry, we can't find the page you are looking for.", @@ -30,15 +30,17 @@ def error_page_not_found() -> JSONResponse: status_code=404, ) + def error_entry_not_found_branch(branch: str, path: str) -> Response: return Response( headers={ "x-error-code": "EntryNotFound", - "x-error-message": f"{path} does not exist on \"{branch}\"", + "x-error-message": f'{path} does not exist on "{branch}"', }, status_code=404, ) + def error_entry_not_found() -> Response: return Response( headers={ @@ -48,6 +50,7 @@ def error_entry_not_found() -> Response: status_code=404, ) + def error_revision_not_found(revision: str) -> Response: return JSONResponse( content={"error": f"Invalid rev id: {revision}"}, @@ -58,6 +61,7 @@ def error_revision_not_found(revision: str) -> Response: status_code=404, ) + # Olah Custom Messages def error_proxy_timeout() -> Response: return Response( @@ -68,6 +72,7 @@ def error_proxy_timeout() -> Response: status_code=504, ) + def error_proxy_invalid_data() -> Response: return Response( headers={ @@ -75,4 +80,4 @@ def error_proxy_invalid_data() -> Response: "x-error-message": "Proxy Invalid Data", }, status_code=504, - ) \ No newline at end of file + ) diff --git a/pyproject.toml b/pyproject.toml index 6ce8df3..5f67db3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "olah" -version = "0.3.1" +version = "0.3.2" description = "Self-hosted lightweight huggingface mirror." readme = "README.md" requires-python = ">=3.8"