Skip to content

Commit 91c15ad

Browse files
committed
If a component errors after starting the response, show that error
Signed-off-by: itowlson <[email protected]>
1 parent 1d68c9d commit 91c15ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/trigger-http/src/wasi.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::io::IsTerminal;
12
use std::net::SocketAddr;
23

34
use anyhow::{anyhow, Context, Result};
@@ -144,7 +145,11 @@ impl HttpExecutor for WasiHttpExecutor {
144145
Ok(())
145146
}
146147
.map_err(|e: anyhow::Error| {
147-
tracing::warn!("component error after response: {e:?}");
148+
if std::io::stderr().is_terminal() {
149+
tracing::error!("Component error after response started. The response may not be fully sent: {e:?}");
150+
} else {
151+
terminal::warn!("Component error after response started: {e:?}");
152+
}
148153
}),
149154
);
150155

0 commit comments

Comments
 (0)