Skip to main content

try_display

Macro try_display 

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

Convenience macro for trying an operation with error display.

If the operation fails, the error is displayed and the macro returns early from the current function.

§Example

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

fn process(boundary: &ErrorBoundary) {
    let data = try_display!(boundary, fetch_data());
    let result = try_display!(boundary, process(data), "Processing data");
    println!("Result: {:?}", result);
}