Skip to main content

AshErrorCode

Enum AshErrorCode 

Source
pub enum AshErrorCode {
Show 15 variants CtxNotFound, CtxExpired, CtxAlreadyUsed, BindingMismatch, ProofMissing, ProofInvalid, CanonicalizationError, ValidationError, ModeViolation, UnsupportedContentType, ScopeMismatch, ChainBroken, InternalError, TimestampInvalid, ScopedFieldMissing,
}
Expand description

Error codes for ASH protocol.

These codes are stable and should not change between versions.

§Standard Error Codes (per ASH specification v2.3.4)

Error CodeHTTP StatusDescription
ASH_CTX_NOT_FOUND450Context ID not found in store
ASH_CTX_EXPIRED451Context has expired
ASH_CTX_ALREADY_USED452Context was already consumed (replay)
ASH_PROOF_INVALID460Proof verification failed
ASH_BINDING_MISMATCH461Request endpoint doesn’t match context
ASH_SCOPE_MISMATCH473Scope hash mismatch
ASH_CHAIN_BROKEN474Chain verification failed
ASH_TIMESTAMP_INVALID482Invalid timestamp format
ASH_PROOF_MISSING483Required X-ASH-Proof header missing
ASH_SCOPED_FIELD_MISSING475Required scoped field missing
ASH_CANONICALIZATION_ERROR484Payload cannot be canonicalized
ASH_VALIDATION_ERROR485Input validation failure
ASH_MODE_VIOLATION486Security mode requirements not met
ASH_UNSUPPORTED_CONTENT_TYPE415Content type not supported
ASH_INTERNAL_ERROR500Internal server error

Every error code has a unique HTTP status code for unambiguous identification.

§Serde Serialization (CR-001)

Error codes serialize with the ASH_ prefix per the ASH specification: CtxNotFound serializes as "ASH_CTX_NOT_FOUND", not "CTX_NOT_FOUND". This ensures cross-SDK interoperability when error codes are transmitted as JSON.

Variants§

§

CtxNotFound

Context not found in store

§

CtxExpired

Context has expired

§

CtxAlreadyUsed

Context was already consumed (replay detected)

§

BindingMismatch

Binding does not match expected endpoint

§

ProofMissing

Required proof not provided

§

ProofInvalid

Proof does not match expected value

§

CanonicalizationError

Payload cannot be canonicalized

§

ValidationError

General validation error (input validation failures) Spec: ASH_VALIDATION_ERROR (HTTP 485)

§

ModeViolation

Mode requirements not met

§

UnsupportedContentType

Content type not supported

§

ScopeMismatch

Scope hash mismatch (v2.2+)

§

ChainBroken

Chain verification failed (v2.3+)

§

InternalError

Internal server error (RNG failure, etc.)

§

TimestampInvalid

Timestamp validation failed (SEC-005)

§

ScopedFieldMissing

Required scoped field missing (SEC-006)

Implementations§

Source§

impl AshErrorCode

Source

pub fn http_status(&self) -> u16

Get the recommended HTTP status code for this error.

v2.3.5: Every error code has a unique HTTP status code for unambiguous identification. ASH-specific errors use the 450-486 range. Standard HTTP codes (415, 500) are used only where a single ASH error maps to a well-known HTTP semantic.

Source

pub fn retryable(&self) -> bool

Whether this error code is retryable.

Retryable errors are transient conditions that may resolve on retry:

  • TimestampInvalid — clock skew may resolve after sync
  • InternalError — transient server failure

All other errors are permanent (wrong proof, missing fields, etc.) and retrying with the same inputs will always produce the same error.

Source

pub fn as_str(&self) -> &'static str

Get the error code as a string.

Returns the error code string per ASH specification v2.3.4.

Trait Implementations§

Source§

impl Clone for AshErrorCode

Source§

fn clone(&self) -> AshErrorCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AshErrorCode

Source§

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

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

impl<'de> Deserialize<'de> for AshErrorCode

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for AshErrorCode

Source§

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

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

impl Hash for AshErrorCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AshErrorCode

Source§

fn eq(&self, other: &AshErrorCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AshErrorCode

CR-001: Custom Serialize implementation to produce spec-compliant ASH_ prefixed strings. #[serde(rename_all = "SCREAMING_SNAKE_CASE")] would produce CTX_NOT_FOUND without the required ASH_ prefix, causing cross-SDK deserialization failures.

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for AshErrorCode

Source§

impl Eq for AshErrorCode

Source§

impl StructuralPartialEq for AshErrorCode

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,