ForcePilot/backend/package/yuxi/channel/adapters/http_error.py
Kris bab30f2715
Some checks failed
Deploy VitePress site to Pages / build (push) Has been cancelled
Ruff Format Check / Ruff Format & Lint (push) Has been cancelled
Deploy VitePress site to Pages / Deploy (push) Has been cancelled
feat:0715
2026-07-15 12:30:58 +08:00

11 lines
464 B
Python

from yuxi.channel.exceptions import ChannelErrorClassification
class HttpErrorClassifier:
def classify(self, status_code: int | None, exc: Exception | None = None) -> ChannelErrorClassification:
if status_code == 429:
return ChannelErrorClassification.RATE_LIMITED
if status_code is not None and 400 <= status_code < 500:
return ChannelErrorClassification.PERMANENT
return ChannelErrorClassification.RETRYABLE