wire-framework 0.1.0

A DI library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use tokio::task::JoinError;

pub fn try_extract_panic_message(err: JoinError) -> String {
    if err.is_panic() {
        let panic = err.into_panic();
        if let Some(panic_string) = panic.downcast_ref::<&'static str>() {
            panic_string.to_string()
        } else if let Some(panic_string) = panic.downcast_ref::<String>() {
            panic_string.to_string()
        } else {
            "Unknown panic".to_string()
        }
    } else {
        "Cancelled task".to_string()
    }
}