Skip to main content

AcdpError

Enum AcdpError 

Source
pub enum AcdpError {
Show 28 variants Canonicalization(String), HashMismatch { stored: ContentHash, recomputed: ContentHash, }, RemoteHashMismatch(String), DataRefHashMismatch(String), InvalidSignature(String), KeyResolution(String), KeyResolutionUnreachable(String), KeyNotAuthorized(String), InvalidBody(String), MissingField(&'static str), SchemaViolation(String), PayloadTooLarge(String), EmbeddedTooLarge(String), UnsupportedAlgorithm(String), NotImplemented(String), NotFound(String), NotAuthorized(String), RateLimited(String), CursorExpired, InvalidCursor(String), SupersededTarget { reason: SupersessionReason, message: String, }, DuplicatePublish(String), CrossRegistryResolutionFailed(String), InvalidReceipt(String), RegistryInternal(String), Registry(WireError), Serialization(String), Http(String),
}
Expand description

Top-level error type.

Variants§

§

Canonicalization(String)

JCS canonicalization failed (input not serializable).

§

HashMismatch

Stored content_hash did not match the recomputed value (locally detected during signature verification).

Fields

§stored: ContentHash

The hash claimed by the body or request.

§recomputed: ContentHash

The hash recomputed by the verifier.

§

RemoteHashMismatch(String)

Wire code: hash_mismatch. The remote registry rejected a publish request because its independent hash recomputation did not match the producer-supplied content_hash. Distinct from the local AcdpError::HashMismatch variant: this one carries the registry’s message verbatim and indicates a producer-side bug (most often canonicalization divergence — see RFC-ACDP-0001 §5.7 and the can-001 conformance fixture).

§

DataRefHashMismatch(String)

Wire code: data_ref_hash_mismatch. A DataRef’s fetched or decoded bytes do not match the producer-declared data_ref.content_hash. The body itself remains cryptographically valid — only the referenced data has diverged. Distinct from AcdpError::RemoteHashMismatch / AcdpError::HashMismatch (body-level ProducerContent failure — the whole body is untrusted) and AcdpError::InvalidSignature (a key / key-binding problem). RFC-ACDP-0002 §6.5–6.6, RFC-ACDP-0007 §5.

§

InvalidSignature(String)

Signature verification failed or signature was malformed. Wire code: invalid_signature.

§

KeyResolution(String)

Wire code: key_resolution_failed (HTTP 400).

§

KeyResolutionUnreachable(String)

Wire code: key_resolution_unreachable (HTTP 502) — transient, may retry.

§

KeyNotAuthorized(String)

Wire code: key_not_authorized (HTTP 403).

§

InvalidBody(String)

Producer body could not be parsed.

§

MissingField(&'static str)

A required field was missing.

§

SchemaViolation(String)

Schema validation failed (string length, array uniqueness, oneOf, etc). Wire code: schema_violation.

§

PayloadTooLarge(String)

Wire code: payload_too_large — request body exceeds the registry limit.

§

EmbeddedTooLarge(String)

Wire code: embedded_too_large — a single DataRef.embedded.content exceeds the 64 KB cap.

§

UnsupportedAlgorithm(String)

Wire code: unsupported_algorithm — the producer used a signature algorithm the registry does not accept.

§

NotImplemented(String)

Wire code: not_implemented — endpoint or feature not supported by this registry.

§

NotFound(String)

Wire code: not_found.

§

NotAuthorized(String)

Wire code: not_authorized — the caller is not permitted to access this resource.

§

RateLimited(String)

Wire code: rate_limited.

§

CursorExpired

Wire code: cursor_expired.

§

InvalidCursor(String)

Wire code: invalid_cursor.

§

SupersededTarget

Wire code: superseded_target. The supersession target was rejected; the SupersessionReason disambiguates the cause.

Fields

§reason: SupersessionReason

Why the target was rejected.

§message: String

Human-readable message from the registry.

§

DuplicatePublish(String)

Wire code: duplicate_publish — an Idempotency-Key replay produced a different request body than the original.

§

CrossRegistryResolutionFailed(String)

Wire code: cross_registry_resolution_failed.

§

InvalidReceipt(String)

Wire code: invalid_receipt. A registry_receipt failed verification: bad signature, a cross-check mismatch (ctx_id, content_hash, key_fingerprint, serving authority), a malformed shape, or a receipt required by policy but absent. Permanent — the receipt will not verify on retry.

§

RegistryInternal(String)

Wire code: internal_error.

§

Registry(WireError)

Catch-all for WireError codes that have no typed variant in this version of the library. Forward-compatible: registries may emit reserved codes (immutable_field, unsupported_embedding_model) that future ACDP versions add.

§

Serialization(String)

JSON (de)serialization failed.

§

Http(String)

HTTP transport error.

Implementations§

Source§

impl AcdpError

Source

pub fn is_transient(&self) -> bool

Whether this error is plausibly transient and worth retrying with the same request body (and, if applicable, the same Idempotency-Key).

Returned by AcdpError::is_transient only for variants whose wire codes the spec marks retryable: key_resolution_unreachable (RFC-ACDP-0001 §5.11), rate_limited (RFC-ACDP-0008 §4.3), cross_registry_resolution_failed (RFC-ACDP-0006 §7), and internal_error (RFC-ACDP-0007 §5). Generic Http transport errors are conservatively treated as transient since they usually mean DNS or TCP-level glitches.

All cryptographic, schema, and authorization errors are NOT transient: a malformed body or invalid signature will not magically validate on retry.

Source

pub fn from_wire_error(wire: WireError) -> Self

Map a wire-protocol crate::wire_error::WireError into a typed AcdpError.

Codes the library does not yet recognize are returned as AcdpError::Registry for forward compatibility.

Trait Implementations§

Source§

impl Debug for AcdpError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AcdpError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for AcdpError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for AcdpError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AcdpError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.