open-standards/joule-code/joule-code-rs/crates/joule-moq/src/error.rs
Transaction Science 08c499f8ca joule-code: port CommunicationOS transport (jwp + joule-moq) into the public standard
The MoQT transport that joule-code-collab's network rung needs lived in the
private joulesperbit repo (as inv-moq + jwp), so a public consumer couldn't
depend on it. Port both into the public open-standards joule-code workspace,
self-contained (concrete dep versions, not workspace-inherited) so a bare git
clone builds them:

- crates/jwp: Joule Wire Protocol — energy-aware binary framing (CBOR, zstd/lz4,
  TCP + optional QUIC). Self-contained, external deps only.
- crates/joule-moq: MoQT (Media-over-QUIC) wire protocol + JWP signed-receipt
  extension for CommunicationOS — Publisher/Subscriber/Relay traits, MockFabric
  (in-process) + a production QUIC path (quic feature). Renamed from inv-moq
  to drop the invisible-* namespace and match the joule-code branding; depends
  only on jwp.

Both build (default + quic) and pass their tests (joule-moq 29, jwp 152) in the
new home. The transport-moqt example now path-deps the public joule-moq instead
of reaching into joulesperbit, and its end-to-end BFT-ops-over-MoQT-with-signed-
receipts tests pass. This unblocks public consumers (agent-zed) from git-depping
the transport for cross-machine fleet coordination.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-13 21:29:05 -04:00

65 lines
1.5 KiB
Rust

//! Error types for MoQT operations.
use thiserror::Error;
pub type MoqResult<T> = Result<T, MoqError>;
#[derive(Debug, Error)]
pub enum MoqError {
#[error("wire decode error: {0}")]
WireDecode(String),
#[error("wire encode error: {0}")]
WireEncode(String),
#[error("varint overflow")]
VarintOverflow,
#[error("unexpected message type: {0:#x}")]
UnexpectedMessage(u64),
#[error("session not established")]
SessionNotEstablished,
#[error("session in invalid state for operation: {0}")]
InvalidSessionState(String),
#[error("subscription not found: track_alias={0}")]
SubscriptionNotFound(u64),
#[error("track not announced: {0}")]
TrackNotAnnounced(String),
#[error("group not yet started: group_id={0}")]
GroupNotStarted(u64),
#[error("receipt verification failed: {0}")]
ReceiptVerification(String),
#[error("merkle proof invalid")]
MerkleProofInvalid,
#[error("identity not bound to track")]
IdentityNotBound,
#[error("joule budget exceeded: declared={declared}, observed={observed}")]
JouleBudgetExceeded { declared: u64, observed: u64 },
#[error("unsupported MoQT draft version: {0:#x}")]
UnsupportedVersion(u32),
#[error("transport error: {0}")]
Transport(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("jwp: {0}")]
Jwp(String),
}
impl From<jwp::JwpError> for MoqError {
fn from(value: jwp::JwpError) -> Self {
MoqError::Jwp(value.to_string())
}
}