Skip to main content

VtaError

Enum VtaError 

Source
pub enum VtaError {
Show 20 variants Auth(String), NotFound(String), Validation(String), Forbidden(String), Conflict(String), Gone(String), Server { status: u16, body: String, }, UnsupportedTransport(String), DidcommTransport(String), DidcommRemote { code: String, comment: String, }, Protocol(String), Serialization(Error), LastServiceRefused, ServiceNotPresent, ServiceAlreadyEnabled, MediatorHandshakeFailed { reason: String, }, DrainTtlOutOfBounds { min: u64, max: u64, requested: u64, }, NoPriorMutation, NoMatchingProtocol { counterparty_did: String, ours: Vec<Protocol>, theirs: Vec<Protocol>, }, Other(String),
}
Expand description

Errors returned by VTA SDK client operations.

Variants§

§

Auth(String)

Authentication failed (401) or token expired.

§

NotFound(String)

Resource not found (404).

§

Validation(String)

Request validation error (400).

§

Forbidden(String)

Permission denied (403).

§

Conflict(String)

Conflict (409) — e.g. duplicate key ID.

§

Gone(String)

Gone (410) — the resource existed but is now permanently unavailable. Most often emitted by the bootstrap carve-out endpoint after it has been consumed; the CLI surfaces this with a “did you mean to run … provision-request” hint instead of a flat string.

§

Server

Server error (5xx).

Fields

§status: u16
§body: String
§

UnsupportedTransport(String)

The operation does not support the transport the client is configured for (e.g. calling a REST-only helper on a client built with DIDComm-only transport, or vice versa).

§

DidcommTransport(String)

DIDComm transport failure (pack/send/pickup). Network-ish — caller may want to retry. Distinct from [Self::Network] which is REST-specific and carries a reqwest::Error.

§

DidcommRemote

Remote endpoint returned a DIDComm problem-report whose code did not match any of the standard e.p.msg.* taxonomy variants (which map to the typed REST-aligned variants above). Inspect code to handle it; a typed Self::Conflict / Self::NotFound / Self::Auth / Self::Validation / Self::Server will already have been emitted for the standard codes.

Fields

§code: String
§comment: String
§

Protocol(String)

Programmer-level protocol error (response shape did not match what the SDK expected — version mismatch or bug). Distinct from remote-error: a peer that returned a problem-report becomes a typed variant via Self::from_problem_report, not this one.

§

Serialization(Error)

Serialization/deserialization error.

§

LastServiceRefused

The operation would leave the VTA’s DID document with no advertised transport services. Per spec §3.2, this is rejected without a --force escape hatch — enable the other transport first if a swap is intended.

§

ServiceNotPresent

update, disable, or a kind-specific drain action was invoked for a service kind that isn’t currently enabled.

§

ServiceAlreadyEnabled

enable was invoked for a service kind that’s already enabled. Use update to change its configuration.

§

MediatorHandshakeFailed

DIDComm handshake against the candidate mediator failed (trust-ping refused, timed out, or peer was unreachable).

Fields

§reason: String
§

DrainTtlOutOfBounds

Drain TTL is outside the valid range. Bounds are MIN_DRAIN_TTL_OVER_DIDCOMM (3600s, when the disable command is itself delivered over DIDComm) and MAX_DRAIN_TTL (30 days). All three fields are in seconds.

Fields

§min: u64
§max: u64
§requested: u64
§

NoPriorMutation

rollback was invoked for a service kind that has no prior mutation in its snapshot store to fail-forward from.

§

NoMatchingProtocol

Catch-all for other errors. No transport protocol is advertised by both this party and the counterparty, so there is no way to communicate. Carries each side’s advertised set (in preference order) so the CLI can show the operator what each offers and which transport to enable. Determined locally by crate::protocol::matching::select_protocol after resolving the peer’s DID document — never a server-returned wire error.

Fields

§counterparty_did: String
§theirs: Vec<Protocol>
§

Other(String)

Implementations§

Source§

impl VtaError

Source

pub fn from_problem_report(code: &str, comment: impl Into<String>) -> Self

Create from a DIDComm problem-report code + comment. Mirrors the REST [Self::from_http] mapping so callers can match on the same variants regardless of transport.

Standard codes (e.p.msg.unauthorized / bad-request / not-found / conflict / internal-error) become typed variants. Anything else lands in Self::DidcommRemote preserving the original code.

Source

pub fn from_typed_payload(payload: TypedErrorPayload) -> Self

Reconstruct the typed VtaError variant from a wire-format TypedErrorPayload. Used by the client when decoding REST response bodies / DIDComm problem-report args for the runtime service-management surface (spec §4).

Source

pub fn to_typed_payload(&self) -> Option<TypedErrorPayload>

Project this error onto the wire-format TypedErrorPayload when the variant is one of the runtime service-management errors. Returns None for variants that don’t have a structured wire form (network errors, generic conflicts, programmer-level protocol errors, …).

Source

pub fn is_gone(&self) -> bool

Returns true if the resource was permanently consumed/gone (410).

Source

pub fn is_conflict(&self) -> bool

Returns true if a create/insert collided with an existing entry (409).

Source

pub fn is_auth(&self) -> bool

Returns true if this is an authentication/authorization error.

Source

pub fn is_network(&self) -> bool

Returns true if this is a network-level error (retryable).

Source

pub fn is_not_found(&self) -> bool

Returns true if the resource was not found.

Source

pub fn suggested_fix(&self) -> Option<&'static str>

Operator-actionable hint matching this error variant.

None for variants where no generic guidance applies (the message itself is the hint, or the failure is a programmer error). The CLI layer (vta-cli-common::render::print_cli_error) already implements bin-aware suggestions (“pnm acl create …”); this method gives non-CLI consumers — web UIs, GUIs, custom dashboards — the same hint surface without needing to fork the dispatch logic.

Returns a &'static str so callers can compose it into their own UI without lifetime juggling. The bin-specific substitution (pnm vs cnm) is left to the CLI layer because only it knows which binary the operator is running.

Trait Implementations§

Source§

impl Debug for VtaError

Source§

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

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

impl Display for VtaError

Source§

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

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

impl Error for VtaError

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<DidKeyError> for VtaError

Source§

fn from(e: DidKeyError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for VtaError

Source§

fn from(source: 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> 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 = 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.