mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-25 21:36:52 +08:00
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
from typing import Any
|
|
|
|
from fastapi import HTTPException, status
|
|
|
|
|
|
class OpenHandsError(HTTPException):
|
|
"""General Error"""
|
|
|
|
def __init__(
|
|
self,
|
|
detail: Any = None,
|
|
headers: dict[str, str] | None = None,
|
|
status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR,
|
|
):
|
|
super().__init__(status_code=status_code, detail=detail, headers=headers)
|
|
|
|
|
|
class AuthError(OpenHandsError):
|
|
"""Error in authentication."""
|
|
|
|
def __init__(
|
|
self,
|
|
detail: Any = None,
|
|
headers: dict[str, str] | None = None,
|
|
status_code: int = status.HTTP_401_UNAUTHORIZED,
|
|
):
|
|
super().__init__(status_code=status_code, detail=detail, headers=headers)
|
|
|
|
|
|
class PermissionsError(OpenHandsError):
|
|
"""Error in permissions."""
|
|
|
|
def __init__(
|
|
self,
|
|
detail: Any = None,
|
|
headers: dict[str, str] | None = None,
|
|
status_code: int = status.HTTP_403_FORBIDDEN,
|
|
):
|
|
super().__init__(status_code=status_code, detail=detail, headers=headers)
|
|
|
|
|
|
class SandboxError(OpenHandsError):
|
|
"""Error in Sandbox."""
|