open-standards/smart-byte/smart-byte-rs/crates/smart-byte-atproto/src/error.rs
Transaction Science 6ea90afbed ingest wave A4: 3 crates · smart-byte-atproto + op-openbanking + eoc-distributed
Smart Byte (1 crate, 2127 LOC, 35 tests)
  smart-byte-atproto    ATProto (Bluesky federation) adapter.
                        PLC + did:web resolution; XRPC client; CARv1 encode/decode
                        with CIDv1 (dag-cbor + raw, SHA-256); sketch MST with
                        order-independent BLAKE3 root; Repo + UnsignedCommit /
                        SignedCommit (Ed25519 over CBOR); firehose transport
                        trait + in-memory impl; AT URI ↔ smart-byte AID bridge
                        with SAID commitment.

OpenPay (1 crate, 2397 LOC, 44 tests)
  op-openbanking        UK OBIE R/W v3.1.10/3.1.11, Berlin Group NextGenPSD2
                        XS2A v1.3.13, STET PSD2 v1.7, Australia CDR Banking v1.31,
                        FDX v5/v6, SGFinDex shapes. AISP / PISP / PIIS / VRP
                        traits. FAPI 1.0 Advanced (PS256/ES256, mTLS, RFC 8705
                        certificate binding, JWK registration). Operators wire
                        their own JWS signer + HTTP transport — keeps the crate
                        KMS-agnostic.

EOC (1 crate, 2179 LOC, 32 tests)
  eoc-distributed       Distributed-inference scheduling. Worker trait with
                        Capability + Accelerator (CPU/GPU/TPU/NPU/Mixed) +
                        Load.busyness()/projected_micro_joules()/projected_g_co2e().
                        RoundRobin / LeastBusy / LatencyWeighted / JouleWeighted
                        (default) / CarbonWeighted routers. Work-stealing
                        scheduler. vLLM-style continuous batching with KV-block
                        budget. Ray-Serve-style auto-scaler with cooldown.
                        KV-cache-aware sticky-session routing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 12:22:09 -04:00

71 lines
2.2 KiB
Rust

//! Typed errors for the AT Protocol adapter.
use thiserror::Error;
/// All AT-Protocol-side errors collapse to a single typed enum so callers
/// can match on the kind without depending on intermediate crates.
#[derive(Debug, Error)]
pub enum AtprotoError {
/// AT URI syntax did not match `at://<authority>[/<path>]`.
#[error("invalid AT URI: {0}")]
InvalidAtUri(String),
/// CAR file structure was malformed or truncated.
#[error("invalid CAR file: {0}")]
InvalidCar(String),
/// IPLD / CID decoding failed.
#[error("invalid CID: {0}")]
InvalidCid(String),
/// DAG-CBOR encoding or decoding failed.
#[error("dag-cbor error: {0}")]
DagCbor(String),
/// JSON encode / decode failed.
#[error("json error: {0}")]
Json(String),
/// Network I/O failed during PDS / firehose interaction.
#[error("network error: {0}")]
Network(String),
/// XRPC server returned a structured error.
#[error("xrpc error {code}: {message}")]
Xrpc {
/// Machine-readable error code (e.g. `"InvalidToken"`).
code: String,
/// Human-readable description.
message: String,
},
/// Cryptographic key material or signature was invalid.
#[error("crypto error: {0}")]
Crypto(String),
/// Repository invariant violated (missing field, bad pointer, etc.).
#[error("repo error: {0}")]
Repo(String),
/// Lexicon schema validation failed.
#[error("lexicon error: {0}")]
Lexicon(String),
/// MST invariant violated.
#[error("mst error: {0}")]
Mst(String),
/// DID resolution failed.
#[error("did error: {0}")]
Did(String),
/// An entry was looked up that does not exist.
#[error("not found: {0}")]
NotFound(String),
}
impl From<serde_json::Error> for AtprotoError {
fn from(e: serde_json::Error) -> Self {
AtprotoError::Json(e.to_string())
}
}
impl From<serde_cbor::Error> for AtprotoError {
fn from(e: serde_cbor::Error) -> Self {
AtprotoError::DagCbor(e.to_string())
}
}
impl From<smart_byte_did::DidError> for AtprotoError {
fn from(e: smart_byte_did::DidError) -> Self {
AtprotoError::Did(e.to_string())
}
}