Implement Error for a few error types (#511)

This commit is contained in:
Stjepan Glavina
2018-08-07 19:45:58 -07:00
committed by Carl Lerche
parent 4153cc4076
commit 6b1e4ab0a3
4 changed files with 46 additions and 3 deletions
+15
View File
@@ -52,6 +52,9 @@ pub use global::spawn2;
use futures::Future;
use std::error::Error;
use std::fmt;
/// A value that executes futures.
///
/// The [`spawn`] function is used to submit a future to an executor. Once
@@ -238,3 +241,15 @@ impl SpawnError {
!self.is_shutdown
}
}
impl fmt::Display for SpawnError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}", self.description())
}
}
impl Error for SpawnError {
fn description(&self) -> &str {
"attempted to spawn task while the executor is at capacity or shut down"
}
}