1
1
use crate :: { logs:: * , requests, Error , ExtensionError , LambdaEvent , NextEvent } ;
2
2
use hyper:: { server:: conn:: AddrStream , Server } ;
3
3
use 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
+ } ;
5
7
use tokio:: sync:: Mutex ;
6
8
use tokio_stream:: StreamExt ;
7
9
use tower:: { service_fn, MakeService , Service } ;
@@ -45,14 +47,14 @@ impl<'a, E, L> Extension<'a, E, L>
45
47
where
46
48
E : Service < LambdaEvent > ,
47
49
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 ,
49
51
50
52
// Fixme: 'static bound might be too restrictive
51
53
L : MakeService < ( ) , Vec < LambdaLog > , Response = ( ) > + Send + Sync + ' static ,
52
54
L :: Service : Service < Vec < LambdaLog > , Response = ( ) > + Send + Sync ,
53
55
<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 ,
56
58
L :: Future : Send ,
57
59
{
58
60
/// Create a new [`Extension`] with a given extension name
@@ -199,6 +201,7 @@ where
199
201
200
202
let res = ep. call ( event) . await ;
201
203
if let Err ( error) = res {
204
+ println ! ( "{:?}" , error) ;
202
205
let req = if is_invoke {
203
206
requests:: init_error ( extension_id, & error. to_string ( ) , None ) ?
204
207
} else {
@@ -228,8 +231,8 @@ impl<T> Identity<T> {
228
231
}
229
232
230
233
impl < 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 > > ;
233
236
type Response = ( ) ;
234
237
235
238
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>
251
254
where
252
255
T : Send + Sync + ' static ,
253
256
{
254
- type Error = Error ;
257
+ type Error = Infallible ;
255
258
type Response = Identity < T > ;
256
259
type Future = Pin < Box < dyn Future < Output = Result < Self :: Response , Self :: Error > > + Send > > ;
257
260
0 commit comments