ref:fe06e284481f73160a86125c17925b79b223a7d6

fix(ci): contextualize log-stream errors in job-view

When `anvil ci job-view` succeeded at fetching metadata but failed streaming logs, the bare `Error: API error (...)` line at the bottom made it look like the whole command had failed. Wrap the error so the user sees what actually went wrong and that the metadata above was fine: Could not fetch logs: API error (500): ... (Job metadata above was retrieved successfully.) Closes #9
SHA: fe06e284481f73160a86125c17925b79b223a7d6
Author: CI <ci@anvil.test>
Date: 2026-05-07 16:44
Parents: 780d25c
1 files changed +9 -1
Type
src/commands/ci.rs +9 −1
@@ -359,7 +359,15 @@
let full_path = format!("{log_path}{follow_query}");
eprintln!(); // blank line before logs
stream_job_logs(&client, &full_path).await?;
if let Err(e) = stream_job_logs(&client, &full_path).await {
// Metadata above was already printed successfully — distinguish so
// the user doesn't think the whole command failed. Print directly
// and exit so the top-level handler doesn't add a redundant
// "Error: ..." line that contradicts the metadata we already showed.
eprintln!("Could not fetch logs: {e}");
eprintln!("(Job metadata above was retrieved successfully.)");
std::process::exit(1);
}
Ok(())
}