diff --git a/src/service/and_then.rs b/src/service/and_then.rs
index 74d247ee..2d248667 100644
--- a/src/service/and_then.rs
+++ b/src/service/and_then.rs
@@ -126,6 +126,7 @@ impl NewService for AndThenNewService
where
A: NewService,
A::Error: Into,
+ A::InitError: Into,
B: NewService,
{
type Request = A::Request;
@@ -133,7 +134,7 @@ where
type Error = B::Error;
type Service = AndThen;
- type InitError = A::InitError;
+ type InitError = B::InitError;
type Future = AndThenNewServiceFuture;
fn new_service(&self) -> Self::Future {
@@ -145,6 +146,7 @@ impl Clone for AndThenNewService
where
A: NewService + Clone,
A::Error: Into,
+ A::InitError: Into,
B: NewService + Clone,
{
fn clone(&self) -> Self {
@@ -185,14 +187,15 @@ impl Future for AndThenNewServiceFuture
where
A: NewService,
A::Error: Into,
- B: NewService,
+ A::InitError: Into,
+ B: NewService,
{
type Item = AndThen;
type Error = B::InitError;
fn poll(&mut self) -> Poll {
if self.a.is_none() {
- if let Async::Ready(service) = self.fut_a.poll()? {
+ if let Async::Ready(service) = self.fut_a.poll().map_err(|e| e.into())? {
self.a = Some(service);
}
}