errors.py 701 B

123456789101112131415161718192021222324252627282930313233
  1. """Standardized error types for the Crypto MCP server."""
  2. class CryptoMCPError(Exception):
  3. """Base error."""
  4. code: str = "INTERNAL_ERROR"
  5. def to_dict(self) -> dict:
  6. return {"error": self.code, "detail": str(self)}
  7. class SymbolNotFoundError(CryptoMCPError):
  8. code = "SYMBOL_NOT_FOUND"
  9. class ProviderError(CryptoMCPError):
  10. code = "PROVIDER_ERROR"
  11. class InsufficientDataError(CryptoMCPError):
  12. code = "INSUFFICIENT_DATA"
  13. class InvalidParamsError(CryptoMCPError):
  14. code = "INVALID_PARAMS"
  15. class UnsupportedIndicatorError(CryptoMCPError):
  16. code = "UNSUPPORTED_INDICATOR"
  17. class UnsupportedTimeframeError(CryptoMCPError):
  18. code = "UNSUPPORTED_TIMEFRAME"