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 Code | HTTP Status | Description |
|---|---|---|
ASH_CTX_NOT_FOUND | 450 | Context ID not found in store |
ASH_CTX_EXPIRED | 451 | Context has expired |
ASH_CTX_ALREADY_USED | 452 | Context was already consumed (replay) |
ASH_PROOF_INVALID | 460 | Proof verification failed |
ASH_BINDING_MISMATCH | 461 | Request endpoint doesn’t match context |
ASH_SCOPE_MISMATCH | 473 | Scope hash mismatch |
ASH_CHAIN_BROKEN | 474 | Chain verification failed |
ASH_TIMESTAMP_INVALID | 482 | Invalid timestamp format |
ASH_PROOF_MISSING | 483 | Required X-ASH-Proof header missing |
ASH_SCOPED_FIELD_MISSING | 475 | Required scoped field missing |
ASH_CANONICALIZATION_ERROR | 484 | Payload cannot be canonicalized |
ASH_VALIDATION_ERROR | 485 | Input validation failure |
ASH_MODE_VIOLATION | 486 | Security mode requirements not met |
ASH_UNSUPPORTED_CONTENT_TYPE | 415 | Content type not supported |
ASH_INTERNAL_ERROR | 500 | Internal 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
impl AshErrorCode
Sourcepub fn http_status(&self) -> u16
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.
Sourcepub fn retryable(&self) -> bool
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 syncInternalError— 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.
Trait Implementations§
Source§impl Clone for AshErrorCode
impl Clone for AshErrorCode
Source§fn clone(&self) -> AshErrorCode
fn clone(&self) -> AshErrorCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AshErrorCode
impl Debug for AshErrorCode
Source§impl<'de> Deserialize<'de> for AshErrorCode
impl<'de> Deserialize<'de> for AshErrorCode
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for AshErrorCode
impl Display for AshErrorCode
Source§impl Hash for AshErrorCode
impl Hash for AshErrorCode
Source§impl PartialEq for AshErrorCode
impl PartialEq for AshErrorCode
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.
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.