Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Sep 6, 2024
1 parent 72ea99c commit b320ce7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions olah/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@ 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.",
},
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={
Expand All @@ -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}"},
Expand All @@ -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(
Expand All @@ -68,11 +72,12 @@ def error_proxy_timeout() -> Response:
status_code=504,
)


def error_proxy_invalid_data() -> Response:
return Response(
headers={
"x-error-code": "ProxyInvalidData",
"x-error-message": "Proxy Invalid Data",
},
status_code=504,
)
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b320ce7

Please sign in to comment.