ForcePilot/backend/package/yuxi/gateway/protocol/errors.py
Kris fee71576a2 feat(gateway): add core gateway protocol implementation
新建了完整的网关协议模块,包含版本协商、基础类型定义、信道请求模型、错误码规范、通信帧结构以及握手流程,实现了完整的客户端-服务端通信协议基础框架
2026-05-12 00:54:15 +08:00

28 lines
587 B
Python

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