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).
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.
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).
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.
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.
Other(String)
Implementations§
Source§impl VtaError
impl VtaError
Sourcepub fn from_problem_report(code: &str, comment: impl Into<String>) -> Self
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.
Sourcepub fn from_typed_payload(payload: TypedErrorPayload) -> Self
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).
Sourcepub fn to_typed_payload(&self) -> Option<TypedErrorPayload>
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, …).
Sourcepub fn is_gone(&self) -> bool
pub fn is_gone(&self) -> bool
Returns true if the resource was permanently consumed/gone (410).
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
Returns true if a create/insert collided with an existing entry (409).
Sourcepub fn is_network(&self) -> bool
pub fn is_network(&self) -> bool
Returns true if this is a network-level error (retryable).
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if the resource was not found.
Sourcepub fn suggested_fix(&self) -> Option<&'static str>
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 Error for VtaError
impl Error for VtaError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()