Skip to main content

AppError

Enum AppError 

Source
pub enum AppError {
Show 22 variants Config(String), Io(Error), Store(Error), Serialization(Error), Internal(String), SecretStore(String), NotFound(String), Conflict(String), Secrets(SecretsResolverError), Authentication(String), Unauthorized(String), Forbidden(String), StepUpRequired(String), Validation(String), TrustTaskMissing, TrustTaskMismatch { expected: String, received: Option<String>, }, TrustTaskMalformed(String), IdempotencyKeyConflict, InvalidCursor, ResourceExhausted(String), ServiceError { status: StatusCode, message: String, }, Vsock { operation: &'static str, source: Error, },
}

Variants§

§

Config(String)

§

Io(Error)

§

Store(Error)

§

Serialization(Error)

§

Internal(String)

§

SecretStore(String)

§

NotFound(String)

§

Conflict(String)

§

Secrets(SecretsResolverError)

§

Authentication(String)

§

Unauthorized(String)

§

Forbidden(String)

§

StepUpRequired(String)

Operation requires a stepped-up (acr=aal2) session, but the caller’s JWT carries a lower acr (typically aal1). Distinct from Self::Forbidden so wallets can react — step_up_required is the operator-friendly signal to trigger a passkey-login or VTA-approval ceremony, not a hard rejection.

Rendered as 403 Forbidden with body { "error": "step_up_required", "message": "...", "requiredAcr": "aal2" } so clients can distinguish it from a role-based rejection without parsing English.

§

Validation(String)

§

TrustTaskMissing

The request did not carry a required Trust-Task header. Routes registered via crate::trust_task::TrustTaskRouter::route_with_task reject missing headers with this variant (400). Only /health is allowed to omit it.

§

TrustTaskMismatch

The request’s Trust-Task header did not match the handler’s registered task. Returned as 415 per spec §16.2; the response body carries the expected + received task URLs so clients can diagnose without re-reading the route table.

Fields

§expected: String
§received: Option<String>
§

TrustTaskMalformed(String)

The supplied Trust-Task value was not a well-formed identifier (empty, non-https://, or contained header-injection control characters). Returned as 400.

§

IdempotencyKeyConflict

A request reused an Idempotency-Key it had previously sent with a different body hash. The cached response is preserved for the original requester; the conflicting retry is rejected with 422 so clients don’t silently get a stale response from a drifting payload.

§

InvalidCursor

A pagination cursor failed integrity verification — either the HMAC tag didn’t validate (tampered, forged, or signed under a different community’s audit_key) or the encoded form was malformed. Returned as 400 with no extra detail so an attacker can’t learn whether their guessed cursor was structurally close to a valid one.

§

ResourceExhausted(String)

A bounded computation aborted because it hit a resource ceiling (time/instruction budget or an input-size cap) before completing. Used by the Rego policy evaluator to refuse pathological policies or adversarial inputs on the unauthenticated join path rather than burning CPU unbounded. Rendered as 503 Service Unavailable — the evaluation did not complete, and the message is generic so an attacker can’t probe the exact limits.

§

ServiceError

Catch-all for service-specific errors (e.g., KeyDerivation, BadGateway, TeeAttestation). Services create helper functions to construct these with appropriate status codes.

Fields

§status: StatusCode
§message: String
§

Vsock

An I/O failure in a vsock operation. Preserves the underlying std::io::Error via #[source] while adding a human-readable label of which operation failed (connect / read / write / flush).

Construct via AppError::vsock for ergonomic .map_err(...).

Fields

§operation: &'static str
§source: Error

Implementations§

Source§

impl AppError

Source

pub fn vsock(operation: &'static str) -> impl FnOnce(Error) -> AppError

Build a closure suitable for .map_err(...) that wraps an std::io::Error into AppError::Vsock with the given operation label. Keeps the source chain intact for downstream error walkers while giving log readers the operation name.

Trait Implementations§

Source§

impl Debug for AppError

Source§

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

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

impl Display for AppError

Source§

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

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

impl Error for AppError

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<AuthError> for AppError

Convert the canonical auth-flow errors into AppError so the route layer’s existing IntoResponse plumbing renders them without backend-specific glue. Each variant lands on the HTTP status reflected in the crate::auth::AuthError doc-comments:

  • Forbidden, DidMethodRejected → 403
  • PendingChallengeLimitReached → 429 via the Validation arm (route layer can return a typed 429 if needed; the canonical variant carries the rate-limit signal in the message).
  • SessionNotFound, SessionStateMismatch, ChallengeMismatch, ChallengeExpired, SignerMismatch, StaleMessage, RefreshTokenInvalid, RefreshTokenExpired → 401
  • AttestationFailed → 503 via Internal (TEE outages are not the caller’s fault).
  • Internal → 500.
Source§

fn from(e: AuthError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AppError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AppError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for AppError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<SecretsResolverError> for AppError

Source§

fn from(source: SecretsResolverError) -> Self

Converts to this type from the input type.
Source§

impl IntoResponse for AppError

Source§

fn into_response(self) -> Response

Create a response.

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> At for T

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ResourceProvider<()> for T

Source§

fn get_resource(&self) -> &()

Returns a reference to the resource of type T.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T

Source§

type Owned = T

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, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>
where T: Sized,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more