Skip to main content

TerminalErrorExt

Trait TerminalErrorExt 

Source
pub trait TerminalErrorExt<T, E> {
    // Required method
    fn terminal(self) -> Result<T, HandlerError>;
}
Expand description

Extension trait for converting any Result error into a TerminalError.

This trait provides a convenient way to convert errors from fallible operations into terminal errors that will not be retried by Restate.

§Example

use restate_sdk::prelude::*;

async fn handle() -> Result<(), HandlerError> {
    let parsed: i32 = "not a number".parse().terminal()?;
    Ok(())
}

Required Methods§

Source

fn terminal(self) -> Result<T, HandlerError>

Convert the error into a TerminalError with the default status code (500).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E> TerminalErrorExt<T, E> for Result<T, E>
where E: Display + Send + Sync + 'static,

Implementors§