summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <vorner+github@vorner.cz>2018-07-24 22:27:57 +0200
committerCarl Lerche <me@carllerche.com>2018-07-24 13:27:57 -0700
commit84db3256284e2cd9db18864666fd76e490f944ac (patch)
treef52be212875430770837d5f595c4ac7250254f24 /src
parent365efec24a5755817810782304be6ed7ede23bb6 (diff)
RunError and few more error types implements Error (#501)
This allows them to be used with things like `failure`.
Diffstat (limited to 'src')
-rw-r--r--src/runtime/current_thread/runtime.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/current_thread/runtime.rs b/src/runtime/current_thread/runtime.rs
index 365c27fa..7df915d3 100644
--- a/src/runtime/current_thread/runtime.rs
+++ b/src/runtime/current_thread/runtime.rs
@@ -9,6 +9,8 @@ use tokio_executor;
use futures::Future;
+use std::fmt;
+use std::error::Error;
use std::io;
/// Single-threaded runtime provides a way to start reactor
@@ -48,6 +50,21 @@ pub struct RunError {
inner: current_thread::RunError,
}
+impl fmt::Display for RunError {
+ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ write!(fmt, "{}", self.inner)
+ }
+}
+
+impl Error for RunError {
+ fn description(&self) -> &str {
+ self.inner.description()
+ }
+ fn cause(&self) -> Option<&Error> {
+ self.inner.cause()
+ }
+}
+
impl Runtime {
/// Returns a new runtime initialized with default configuration values.
pub fn new() -> io::Result<Runtime> {