11use crate :: { logs:: * , requests, Error , ExtensionError , LambdaEvent , NextEvent } ;
22use hyper:: { server:: conn:: AddrStream , Server } ;
33use lambda_runtime_api_client:: Client ;
4- use std:: { fmt, future:: ready, future:: Future , net:: SocketAddr , path:: PathBuf , pin:: Pin , sync:: Arc } ;
4+ use std:: {
5+ convert:: Infallible , fmt, future:: ready, future:: Future , net:: SocketAddr , path:: PathBuf , pin:: Pin , sync:: Arc ,
6+ } ;
57use tokio:: sync:: Mutex ;
68use tokio_stream:: StreamExt ;
79use tower:: { service_fn, MakeService , Service } ;
@@ -45,14 +47,14 @@ impl<'a, E, L> Extension<'a, E, L>
4547where
4648 E : Service < LambdaEvent > ,
4749 E :: Future : Future < Output = Result < ( ) , E :: Error > > ,
48- E :: Error : Into < Box < dyn std:: error:: Error + Send + Sync > > + fmt:: Display ,
50+ E :: Error : Into < Box < dyn std:: error:: Error + Send + Sync > > + fmt:: Display + fmt :: Debug ,
4951
5052 // Fixme: 'static bound might be too restrictive
5153 L : MakeService < ( ) , Vec < LambdaLog > , Response = ( ) > + Send + Sync + ' static ,
5254 L :: Service : Service < Vec < LambdaLog > , Response = ( ) > + Send + Sync ,
5355 <L :: Service as Service < Vec < LambdaLog > > >:: Future : Send + ' a ,
54- L :: Error : Into < Box < dyn std:: error:: Error + Send + Sync > > ,
55- L :: MakeError : Into < Box < dyn std:: error:: Error + Send + Sync > > ,
56+ L :: Error : Into < Box < dyn std:: error:: Error + Send + Sync > > + fmt :: Debug ,
57+ L :: MakeError : Into < Box < dyn std:: error:: Error + Send + Sync > > + fmt :: Debug ,
5658 L :: Future : Send ,
5759{
5860 /// Create a new [`Extension`] with a given extension name
@@ -199,6 +201,7 @@ where
199201
200202 let res = ep. call ( event) . await ;
201203 if let Err ( error) = res {
204+ println ! ( "{:?}" , error) ;
202205 let req = if is_invoke {
203206 requests:: init_error ( extension_id, & error. to_string ( ) , None ) ?
204207 } else {
@@ -228,8 +231,8 @@ impl<T> Identity<T> {
228231}
229232
230233impl < T > Service < T > for Identity < T > {
231- type Error = Error ;
232- type Future = Pin < Box < dyn Future < Output = Result < ( ) , Error > > + Send > > ;
234+ type Error = Infallible ;
235+ type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
233236 type Response = ( ) ;
234237
235238 fn poll_ready ( & mut self , _cx : & mut core:: task:: Context < ' _ > ) -> core:: task:: Poll < Result < ( ) , Self :: Error > > {
@@ -251,7 +254,7 @@ impl<T> Service<()> for MakeIdentity<T>
251254where
252255 T : Send + Sync + ' static ,
253256{
254- type Error = Error ;
257+ type Error = Infallible ;
255258 type Response = Identity < T > ;
256259 type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
257260
0 commit comments