Tim O'Farrell f292f3a84d
V1 Integration (#11183)
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>
2025-10-14 02:16:44 +00:00

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."""