ForcePilot/backend/package/yuxi/gateway/protocol/errors.py

28 lines
587 B
Python
Raw Normal View History

from __future__ import annotations
from enum import IntEnum
from pydantic import BaseModel
class ErrorCode(IntEnum):
INVALID_REQUEST = -32600
METHOD_NOT_FOUND = -32601
INVALID_PARAMS = -32602
INTERNAL_ERROR = -32603
RATE_LIMITED = -32000
AUTH_REQUIRED = -32001
NOT_LINKED = -32002
NOT_PAIRED = -32003
AGENT_TIMEOUT = -32004
APPROVAL_NOT_FOUND = -32005
UNAVAILABLE = -32006
class ErrorDetail(BaseModel):
code: ErrorCode
message: str
details: str | None = None
retryable: bool = False
retry_after_ms: int | None = None