This commit is contained in:
2026-07-16 16:31:36 +03:00
commit 3c8d2dd572
26 changed files with 1684 additions and 0 deletions

1
src/errors/__init__.py Normal file
View File

@@ -0,0 +1 @@
'''error handling classes'''

View File

@@ -0,0 +1,14 @@
from fastapi import HTTPException
class Errors:
def __init__(self) -> None:
pass
def credentials_error(self, detail:str)->HTTPException:
raise HTTPException(status_code=401, detail=detail, headers={"WWW-Authenticate":"Bearer"})
def forbidden_error(self,detail:str)->HTTPException:
raise HTTPException(status_code=403, detail=detail, headers={"Cache-Control": "no-store, max-age=0"})
def not_found_error(self, detail:str)->HTTPException:
raise HTTPException(status_code=404, detail=detail, headers={"Cache-Control": "no-store, max-age=0"})