@@ -326,9 +326,11 @@ pub async fn serve_interface<T: {wrpc_transport}::Serve, U>(
326
326
self . src,
327
327
r#"
328
328
let rx = rx.map({tracing}::Instrument::in_current_span).map({tokio}::spawn);
329
+ {tracing}::trace!(instance = "{instance}", func = "{wit_name}", "calling handler");
329
330
match {trait_name}::{name}(&handler, cx"# ,
330
331
tokio = self . gen . tokio_path( ) ,
331
332
tracing = self . gen . tracing_path( ) ,
333
+ wit_name = func. name,
332
334
) ;
333
335
for i in 0 ..func. params . len ( ) {
334
336
uwrite ! ( self . src, ", p{i}" ) ;
@@ -352,8 +354,12 @@ pub async fn serve_interface<T: {wrpc_transport}::Serve, U>(
352
354
).await {{
353
355
Ok(()) => {{
354
356
if let Some(rx) = rx {{
355
- if let Err(err) = rx.await? {{
356
- {tracing}::warn!(?err, "failed to receive async `{instance}.{wit_name}` invocation parameters");
357
+ {tracing}::trace!(instance = "{instance}", func = "{wit_name}", "receiving async invocation parameters");
358
+ if let Err(err) = {anyhow}::Context::context(
359
+ rx.await,
360
+ "receipt of async `.{wit_name}` invocation parameters failed",
361
+ )? {{
362
+ {tracing}::warn!(?err, instance = "{instance}", func = "{wit_name}", "failed to receive async invocation parameters");
357
363
}}
358
364
}}
359
365
continue;
@@ -362,22 +368,23 @@ pub async fn serve_interface<T: {wrpc_transport}::Serve, U>(
362
368
if let Some(rx) = rx {{
363
369
rx.abort();
364
370
}}
365
- {tracing}::warn!(?err, "failed to transmit ` {instance}. {wit_name}` invocation results");
371
+ {tracing}::warn!(?err, instance = " {instance}", func = " {wit_name}", "failed to transmit invocation results");
366
372
}}
367
373
}}
368
374
}},
369
375
Err(err) => {{
370
376
if let Some(rx) = rx {{
371
377
rx.abort();
372
378
}}
373
- {tracing}::warn!(?err, "failed to serve ` {instance}. {wit_name}` invocation");
379
+ {tracing}::warn!(?err, instance = " {instance}", func = " {wit_name}", "failed to serve invocation");
374
380
}}
375
381
}}
376
382
}},
377
383
Some(Err(err)) => {{
378
- {tracing}::error!("failed to accept invocation");
384
+ {tracing}::error!(?err, instance = "{instance}", func = "{wit_name}", "failed to accept invocation");
379
385
}},
380
386
None => {{
387
+ {tracing}::warn!(instance = "{instance}", func = "{wit_name}", "invocation stream unexpectedly finished");
381
388
{anyhow}::bail!("`{instance}.{wit_name}` stream unexpectedly finished")
382
389
}},
383
390
}}
0 commit comments