Initial curated ITWorx_MCP_Hub source from 368fba691ea8d23403b4d56b53b5ec670d7c5020

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:36:21 +02:00
commit cb5be898ea
663 files changed
+82674

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
"""Stable, sanitized dataplane error categories."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class RouterError(Exception):
code: str
message: str
status_code: int
retryable: bool = False
AUTHENTICATION_REQUIRED = RouterError("AUTHENTICATION_REQUIRED", "Authentication is required.", 401)
TOKEN_INVALID = RouterError("TOKEN_INVALID", "The supplied credential is invalid.", 401)
ACCESS_DENIED = RouterError("ACCESS_DENIED", "Access to this endpoint is denied.", 403)
RESOURCE_NOT_REGISTERED = RouterError(
"RESOURCE_NOT_REGISTERED", "The requested endpoint is not registered.", 404
)
VALIDATION_FAILED = RouterError(
"VALIDATION_FAILED", "The request did not meet the protocol limits.", 400
)
TARGET_UNAVAILABLE = RouterError(
"TARGET_UNAVAILABLE", "The trusted gateway is unavailable.", 503, True
)
OVERLOADED = RouterError("OVERLOADED", "The gateway is at capacity; retry shortly.", 503, True)
TIMEOUT = RouterError("TIMEOUT", "The trusted gateway timed out.", 504, True)
RESULT_TOO_LARGE = RouterError(
"RESULT_TOO_LARGE", "The gateway response exceeded the output budget.", 502
)
UPSTREAM_PROTOCOL_ERROR = RouterError(
"UPSTREAM_PROTOCOL_ERROR", "The gateway returned an invalid protocol response.", 502
)
INTERNAL_ERROR = RouterError("INTERNAL_ERROR", "The dataplane router failed safely.", 500, True)