pub struct NodeError {
pub kind: String,
pub message: String,
pub retryable: bool,
pub retry_after_ms: Option<u64>,
}Expand description
Error produced by a node.
Fields§
§kind: StringMachine-readable category, e.g. timeout, http, invalid_input, model.
message: String§retryable: boolWhether a retry may succeed. Non-retryable errors skip the retry policy.
retry_after_ms: Option<u64>Minimum delay before a retry, as requested by the remote side (e.g. an
HTTP Retry-After header or a provider rate limit). The engine waits for
the larger of this and the node’s retry policy delay.
Implementations§
Source§impl NodeError
impl NodeError
pub fn new(kind: impl Into<String>, message: impl Into<String>) -> Self
Sourcepub fn fatal(kind: impl Into<String>, message: impl Into<String>) -> Self
pub fn fatal(kind: impl Into<String>, message: impl Into<String>) -> Self
Error that retrying cannot fix (bad configuration, invalid input).
Sourcepub fn with_retry_after(self, retry_after_ms: Option<u64>) -> Self
pub fn with_retry_after(self, retry_after_ms: Option<u64>) -> Self
Attach a server-requested retry delay.
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Replace the message, keeping kind, retryability and retry delay.
pub fn invalid_input(message: impl Into<String>) -> Self
pub fn timeout(after: Duration) -> Self
Trait Implementations§
Source§impl Error for NodeError
impl Error for NodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
impl StructuralPartialEq for NodeError
Auto Trait Implementations§
impl Forget for NodeError
impl Freeze for NodeError
impl Move for NodeError
impl RefUnwindSafe for NodeError
impl Send for NodeError
impl Sync for NodeError
impl Unpin for NodeError
impl UnsafeUnpin for NodeError
impl UnwindSafe for NodeError
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
Mutably borrows from an owned value. Read more