Skip to main content

AppError

Enum AppError 

Source
pub enum AppError {
Show 19 variants Config(String), Io(Error), Store(String), SecretStore(String), Serialization(Error), Internal(String), NotFound(String), Conflict(String), Authentication(String), Unauthorized(String), Forbidden(String), StepUpRequired(String), Validation(String), QuotaExceeded(String), TrustTaskMissing, TrustTaskMalformed(String), TrustTaskMismatch { expected: String, received: Option<String>, }, DomainDisabled { domain: String, message: Option<String>, }, AgentName(AgentNameError),
}

Variants§

§

Config(String)

§

Io(Error)

§

Store(String)

§

SecretStore(String)

§

Serialization(Error)

§

Internal(String)

§

NotFound(String)

§

Conflict(String)

§

Authentication(String)

§

Unauthorized(String)

§

Forbidden(String)

§

StepUpRequired(String)

The caller is authenticated but the operation requires a higher assurance level (acr == aal2) than the session currently holds. Renders to 403 with the distinct body { "error": "step_up_required", "required_acr": "aal2" } so the wallet can trigger a step-up ceremony rather than treating it as a plain permission denial.

§

Validation(String)

§

QuotaExceeded(String)

§

TrustTaskMissing

Trust-Task header was absent on a route that requires it. Renders to 400 Bad Request with body { "error": "TrustTaskMissing" }.

§

TrustTaskMalformed(String)

Trust-Task header was present but malformed (non-HTTPS, empty, or contained control characters). Carries the offending value so callers can debug. Renders to 400 with body { "error": "TrustTaskMalformed", "received": "..." }.

§

TrustTaskMismatch

Trust-Task header was well-formed but did not exact-match the route’s registered task. Renders to 415 Unsupported Media Type with body { "error": "TrustTaskMismatch", "expected": "...", "received": "..." }.

Fields

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

DomainDisabled

Resolution attempted against a configured-but-disabled domain. Per docs/multi-domain-spec.md §3, renders to 503 with the maintenance-status JSON body { "status": "disabled", "domain": "<name>", "message"?, "eta"? }. Distinct from NotFound — 404 means “we don’t serve this”, 503 means “we serve this but it’s temporarily unavailable”.

Fields

§domain: String
§message: Option<String>
§

AgentName(AgentNameError)

An agent-name operation (did_ops::set_agent_name and friends) failed a name-specific precondition. Carries a typed AgentNameError so the Trust-Task and REST surfaces can map it to a spec error code without sniffing message prose — the same discipline ValidationKind follows.

Implementations§

Source§

impl AppError

Source

pub fn validation(kind: ValidationKind, msg: impl Into<String>) -> AppError

Create a tagged validation error.

Source

pub fn validation_kind(&self) -> ValidationKind

Classify a Validation error’s kind by its tag prefix.

Source

pub fn quota_kind(&self) -> QuotaKind

Classify a QuotaExceeded error’s kind by its content.

Source§

impl AppError

Source

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

Stable wire-level DIDComm protocol-error code for this AppError.

Backed by ValidationKind tags rather than substring sniffing on the Display message, so a wording change in any AppError::Validation("...") literal doesn’t silently re-route the protocol code. Both DIDComm dispatchers (messaging::dispatch_did_op and routes/didcomm.rs::dispatch) call this so the same error always produces the same wire code regardless of transport.

The mapping:

  • Unauthorized / Forbidden → e.p.did.unauthorized
  • QuotaExceeded(Size) → e.p.did.size-exceeded
  • QuotaExceeded(Count) → e.p.did.quota-exceeded
  • Conflict → e.p.did.path-unavailable
  • NotFound → e.p.did.mnemonic-not-found
  • Validation(InvalidLog) → e.p.did.invalid-log
  • Validation(InvalidPath) → e.p.did.path-invalid
  • Validation(InvalidWitness) → e.p.did.witness-invalid
  • Validation(Other) → e.p.did.validation-error
  • everything else (5xx-shaped) → e.p.did.internal-error
Source

pub fn user_message(&self) -> String

Stable public message intended for HTTP responses. Decoupled from Display (which tracing/logging uses) so the wire-level contract doesn’t drift when an AppError(...) literal’s wording changes elsewhere.

Variants that name internal identifiers (Forbidden may carry a DID or ACL reason; NotFound may include a mnemonic) collapse to a fixed string. Variants that are user-input-shaped (Validation, Conflict, QuotaExceeded) pass the message through sanitize_user_message so a caller can’t get arbitrary control characters echoed back. 5xx variants never reach this path (the response builder short-circuits to a generic body).

Trait Implementations§

Source§

impl Debug for AppError

Source§

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

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

impl Display for AppError

Source§

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

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

Source§

fn from(source: AgentNameError) -> AppError

Converts to this type from the input type.
Source§

impl From<AuthError> for AppError

Conversion from the canonical auth-flow errors in vti-common into did-hosting’s AppError. Mirrors the From<AuthError> for vti_common::AppError impl on the VTI side — the canonical /auth/* handlers raise vti_common::AuthError variants and each service’s AppError knows how to render them through its own IntoResponse plumbing.

Source§

fn from(e: AuthError) -> AppError

Converts to this type from the input type.
Source§

impl From<Error> for AppError

Source§

fn from(source: Error) -> AppError

Converts to this type from the input type.
Source§

impl From<Error> for AppError

Source§

fn from(source: Error) -> AppError

Converts to this type from the input type.
Source§

impl IntoResponse for AppError

Source§

fn into_response(self) -> Response<Body>

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

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<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> 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