mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
Add a verbose error message for BlockingError (#451)
Add a verbose error message for EnterError while trying to run tokio_threadpool::blocking on a current_thread::Runtime
This commit is contained in:
@@ -6,7 +6,6 @@ use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
/// Error raised by `blocking`.
|
||||
#[derive(Debug)]
|
||||
pub struct BlockingError {
|
||||
_p: (),
|
||||
}
|
||||
@@ -156,6 +155,14 @@ impl fmt::Display for BlockingError {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for BlockingError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("BlockingError")
|
||||
.field("reason", &self.description())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for BlockingError {
|
||||
fn description(&self) -> &str {
|
||||
"`blocking` annotation used from outside the context of a thread pool"
|
||||
|
||||
Reference in New Issue
Block a user