caelum0x 2d2b15c7fe feat: full guardrail-alpha system + CLI modularization + Vercel deploy config
- Rust engine: real bootstrap/wiring preflight (guardrail-agent), execution layer (retry/router/pre-trade/post-trade/reconciliation), guardrail-doctor diagnostics with allowlist-drift guard.

- guardrail-cli: extracted pure helpers into util.rs (split in progress).

- 6 Track-2 skills + ensemble; python-lab analytics (regime/drawdown/montecarlo/dossier/ensemble/journal/seed); clients (ts/py/go/mcp/langchain/web-lite/proof-verifier); alert relay; scenarios; helm/k8s/compose; docs.

- dashboard/vercel.json + docs/VERCEL_DEPLOY.md for Vercel deployment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:02:22 +03:00

117 lines
2.2 KiB
Python

"""
Custom exceptions for bnbagent SDK.
Provides a hierarchy of domain-specific exceptions for better error handling
and propagation throughout the SDK.
"""
from __future__ import annotations
class BNBAgentError(Exception):
"""Base exception for all bnbagent SDK errors."""
pass
class ContractError(BNBAgentError):
"""
Contract call or transaction failed.
Raised when a smart contract interaction fails, including:
- Transaction reverts
- Gas estimation failures
- Invalid function calls
"""
pass
class StorageError(BNBAgentError):
"""
Storage operation failed.
Raised when file or IPFS storage operations fail, including:
- File not found
- Upload/download failures
- Invalid data format
"""
pass
class ConfigurationError(BNBAgentError):
"""
Missing or invalid configuration.
Raised when required configuration is missing or invalid, including:
- Missing environment variables
- Invalid contract addresses
- Missing private keys
"""
pass
class ABILoadError(BNBAgentError):
"""
Failed to load contract ABI.
Raised when ABI file loading fails, including:
- File not found
- Invalid JSON format
"""
pass
class NetworkError(BNBAgentError):
"""
Network or RPC communication failed.
Raised when network operations fail, including:
- RPC connection errors
- Rate limiting (429)
- Timeouts
"""
pass
class RpcRangeLimitError(NetworkError):
"""
An RPC log/range query was rejected by the node's rate or range limit
(e.g. JSON-RPC ``-32005 limit exceeded``).
Retryable: the queried data may exist but could not be fetched right
now — callers must NOT treat this as "event not found".
"""
pass
class JobError(BNBAgentError):
"""
Job operation failed.
Raised when job-related operations fail, including:
- Job not found
- Invalid job state
- Unauthorized access
"""
pass
class NegotiationError(BNBAgentError):
"""
Negotiation failed.
Raised when negotiation operations fail, including:
- Price validation errors
- Invalid terms
- Unsupported service types
"""
pass