Phase 1 Complete by Claude Code
This commit is contained in:
@@ -1 +1,20 @@
|
||||
# TODO: Custom error handlers
|
||||
from fastapi import HTTPException
|
||||
|
||||
|
||||
class AuthenticationError(HTTPException):
|
||||
def __init__(self, detail: str = "Could not validate credentials"):
|
||||
super().__init__(
|
||||
status_code=401,
|
||||
detail=detail,
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
|
||||
class AuthorizationError(HTTPException):
|
||||
def __init__(self, detail: str = "Insufficient permissions"):
|
||||
super().__init__(status_code=403, detail=detail)
|
||||
|
||||
|
||||
class NotFoundError(HTTPException):
|
||||
def __init__(self, resource: str = "Resource"):
|
||||
super().__init__(status_code=404, detail=f"{resource} not found")
|
||||
|
||||
Reference in New Issue
Block a user