Skip to content

Commit 9d3d4d8

Browse files
better error formatting
1 parent 7116501 commit 9d3d4d8

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

codex-rs/tui/src/chatwidget.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,15 @@ impl ChatWidget {
524524
self.maybe_send_next_queued_input();
525525
}
526526

527-
fn on_warning(&mut self, message: String) {
528-
self.add_to_history(history_cell::new_warning_event(message));
527+
fn on_warning(&mut self, message: impl Into<String>) {
528+
self.add_to_history(history_cell::new_warning_event(message.into()));
529529
self.request_redraw();
530530
}
531531

532532
fn on_mcp_startup_update(&mut self, ev: McpStartupUpdateEvent) {
533533
let mut status = self.mcp_startup_status.take().unwrap_or_default();
534534
if let McpStartupStatus::Failed { error } = &ev.status {
535-
self.on_warning(format!("MCP `{}` failed to start: {error}", ev.server));
535+
self.on_warning(error);
536536
}
537537
status.insert(ev.server, ev.status);
538538
self.mcp_startup_status = Some(status);

codex-rs/tui/src/history_cell.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,10 +999,8 @@ fn try_new_completed_mcp_tool_call_with_image_output(
999999
}
10001000

10011001
#[allow(clippy::disallowed_methods)]
1002-
pub(crate) fn new_warning_event(message: String) -> PlainHistoryCell {
1003-
PlainHistoryCell {
1004-
lines: vec![vec![format!("⚠ {message}").yellow()].into()],
1005-
}
1002+
pub(crate) fn new_warning_event(message: String) -> PrefixedWrappedHistoryCell {
1003+
PrefixedWrappedHistoryCell::new(message.yellow(), "⚠ ".yellow(), " ")
10061004
}
10071005

10081006
#[derive(Debug)]

0 commit comments

Comments
 (0)