From 91c15adf9e0ad0622843e54c7f4af17566dfff26 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 10 Mar 2025 13:03:24 +1300 Subject: [PATCH] If a component errors after starting the response, show that error Signed-off-by: itowlson --- crates/trigger-http/src/wasi.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/trigger-http/src/wasi.rs b/crates/trigger-http/src/wasi.rs index 0e431a488b..baca9eebc7 100644 --- a/crates/trigger-http/src/wasi.rs +++ b/crates/trigger-http/src/wasi.rs @@ -1,3 +1,4 @@ +use std::io::IsTerminal; use std::net::SocketAddr; use anyhow::{anyhow, Context, Result}; @@ -144,7 +145,11 @@ impl HttpExecutor for WasiHttpExecutor { Ok(()) } .map_err(|e: anyhow::Error| { - tracing::warn!("component error after response: {e:?}"); + if std::io::stderr().is_terminal() { + tracing::error!("Component error after response started. The response may not be fully sent: {e:?}"); + } else { + terminal::warn!("Component error after response started: {e:?}"); + } }), );