pub struct FnError {
pub code: u32,
pub message: String,
pub retryable: bool,
}Expand description
Per-invocation error returned by a plugin’s work function.
FnError is what crosses the host↔plugin boundary on every call. The
host wraps it into the user-facing error chain. WASM plugins return this
shape over the WIT fn-error record.
Fields§
§code: u32Plugin-defined error code. Reserved range 0..=0xFF for framework
errors; plugins use 0x100..=u32::MAX.
message: StringHuman-readable error message.
retryable: boolWhether the caller should retry the operation (e.g., transient network failure).
Implementations§
Source§impl FnError
impl FnError
Sourcepub const CODE_UNKNOWN_FUNCTION: u32 = 0x01
pub const CODE_UNKNOWN_FUNCTION: u32 = 0x01
Framework-reserved code for “unknown function name at dispatch site”.
Sourcepub const CODE_TYPE_COERCION: u32 = 0x02
pub const CODE_TYPE_COERCION: u32 = 0x02
Framework-reserved code for “type-coercion failure on input column”.
Sourcepub const CODE_UNEXPECTED_NULL: u32 = 0x03
pub const CODE_UNEXPECTED_NULL: u32 = 0x03
Framework-reserved code for “null encountered where forbidden”.
Sourcepub const CODE_RESOURCE_LIMIT: u32 = 0x04
pub const CODE_RESOURCE_LIMIT: u32 = 0x04
Framework-reserved code for “resource limit exceeded”.
Sourcepub const CODE_FORBIDDEN: u32 = 0x05
pub const CODE_FORBIDDEN: u32 = 0x05
Framework-reserved code for “plugin attempted forbidden side effect”.
Sourcepub fn new(code: u32, message: impl Into<String>) -> Self
pub fn new(code: u32, message: impl Into<String>) -> Self
Build an FnError with the given code and message; not retryable.
Sourcepub fn unknown_function(name: impl AsRef<str>) -> Self
pub fn unknown_function(name: impl AsRef<str>) -> Self
Convenience constructor for “unknown function” errors.
Trait Implementations§
Source§impl Error for FnError
impl Error for FnError
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 FnError
impl RefUnwindSafe for FnError
impl Send for FnError
impl Sync for FnError
impl Unpin for FnError
impl UnsafeUnpin for FnError
impl UnwindSafe for FnError
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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