🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
at main 26 lines 607 B view raw
1//! `cargo run --example error_handler` 2 3use windmark::response::Response; 4 5#[windmark::main] 6async fn main() -> Result<(), Box<dyn std::error::Error>> { 7 let mut error_count = 0; 8 9 windmark::router::Router::new() 10 .set_private_key_file("windmark_private.pem") 11 .set_certificate_file("windmark_public.pem") 12 .set_error_handler(move |_| { 13 error_count += 1; 14 15 println!("{} errors so far", error_count); 16 17 Response::permanent_failure("e") 18 }) 19 .mount("/error", |_| { 20 let nothing = None::<String>; 21 22 Response::success(nothing.unwrap()) 23 }) 24 .run() 25 .await 26}