-
But one problem, I can't figure out which task returned that error, and since they're just bubbled up So far, the solution I found is an encapsulating enum Error {
TaskA(std::io::Error),
TaskB(std::io::Error),
TaskC(std::io::Error),
}
match tokio::try_join!(
async { task_a.await.map_err(|e| Error::TaskA(e)) },
async { task_b.await.map_err(|e| Error::TaskB(e)) },
async { task_c.await.map_err(|e| Error::TaskC(e)) },
) {
Ok(_) => {...},
Err(Error::TaskA(e)) => {...},
Err(Error::TaskB(e)) => {...},
Err(Error::TaskC(e)) => {...},
}; But that looks a little convoluted, so I'm asking if there's a better solution and I'm doing something stupid. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The macro doesn't provide anything built-in for this. |
Beta Was this translation helpful? Give feedback.
The macro doesn't provide anything built-in for this.