Skip to main content

try_display_result

Macro try_display_result 

Source
macro_rules! try_display_result {
    ($boundary:expr, $expr:expr) => { ... };
    ($boundary:expr, $expr:expr, $ctx:expr) => { ... };
}
Expand description

Convenience macro for trying an operation with error display, returning Result.

If the operation fails, the error is displayed and returned as Err.

§Example

use fastmcp_console::{try_display_result, error::ErrorBoundary, console};

fn process(boundary: &ErrorBoundary) -> Result<(), McpError> {
    let data = try_display_result!(boundary, fetch_data());
    let result = try_display_result!(boundary, process(data));
    Ok(())
}