pub struct InvokeError { /* private fields */ }Expand description
Typed invoke error.
Replaces the previous Result<Value, String> contract. The kind
selects a stable IPC error code and a fixed public message; detail
carries host-only diagnostic text (e.g. for stderr logs) and is never
forwarded to IPC clients, so guests cannot exfiltrate arbitrary content
through the error path.
Implementations§
Source§impl InvokeError
impl InvokeError
Sourcepub const fn new(kind: InvokeErrorKind) -> Self
pub const fn new(kind: InvokeErrorKind) -> Self
Create a new typed error with no host detail.
Sourcepub fn with_detail(kind: InvokeErrorKind, detail: impl Into<String>) -> Self
pub fn with_detail(kind: InvokeErrorKind, detail: impl Into<String>) -> Self
Create a new typed error carrying host-only diagnostic text.
detail is intended for eprintln! logs and must not be sent
to IPC clients. Guests can fully control this string via the WIT
handler-error payload, so it cannot be trusted for security
decisions. It is truncated to MAX_DETAIL_BYTES on a UTF-8 char
boundary so a malicious guest cannot grow host memory unboundedly
through the error path.
Sourcepub const fn kind(&self) -> InvokeErrorKind
pub const fn kind(&self) -> InvokeErrorKind
Error category.
Sourcepub const fn stable_code(&self) -> &'static str
pub const fn stable_code(&self) -> &'static str
Stable IPC error code. Backwards-compatible with the v1/v2 wire
format produced by the previous map_invoke_error string matching.
All four guest-reported WIT handler-error variants
(invalid-model, invalid-input, unsupported-capability,
execution-failed) collapse to handlerInternalError on the wire
to preserve compatibility with v1/v2 clients. The host still
distinguishes them internally via InvokeError::kind for
logging and diagnostics.
Sourcepub const fn public_message(&self) -> &'static str
pub const fn public_message(&self) -> &'static str
Fixed public message. Never contains guest-supplied content.
Trait Implementations§
Source§impl Clone for InvokeError
impl Clone for InvokeError
Source§fn clone(&self) -> InvokeError
fn clone(&self) -> InvokeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InvokeError
impl Debug for InvokeError
Source§impl Display for InvokeError
impl Display for InvokeError
Source§impl Error for InvokeError
impl Error for InvokeError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for InvokeError
impl RefUnwindSafe for InvokeError
impl Send for InvokeError
impl Sync for InvokeError
impl Unpin for InvokeError
impl UnsafeUnpin for InvokeError
impl UnwindSafe for InvokeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more