artifactize_core/task.rs
1//! Joining spawned tasks. A task that panicked has a bug, so its panic continues in the task
2//! that joins it instead of becoming an ordinary failure; a cancelled task stays an error.
3
4/// `result` of joining a task, with a panic resumed here.
5pub fn joined<T>(result: Result<T, tokio::task::JoinError>) -> Result<T, tokio::task::JoinError> {
6 match result {
7 Err(error) if error.is_panic() => std::panic::resume_unwind(error.into_panic()),
8 other => other,
9 }
10}