daemon: preserve full anyhow context chain in IPC error replies

e.to_string() on an anyhow::Error only prints the outermost .context()
message; the underlying cause (why connect_app/build_pipeline/etc.
actually failed) was being silently dropped before it ever reached the
GUI or bread event log. Use "{e:#}" instead.
This commit is contained in:
Breadway 2026-08-05 19:14:58 +08:00
parent 5b49955e33
commit 14274856a3

View file

@ -163,8 +163,11 @@ impl Daemon {
let _ = reply.send(Ok(()));
}
Err(e) => {
bread_events::emit_mirroring_failed(&self.bread_client, &device.id, &e.to_string());
let _ = reply.send(Err(e.to_string()));
// `{e:#}` (not `{e}`/`to_string()`) so the full anyhow
// context chain reaches the caller/GUI instead of just
// the outermost ".context()" message.
bread_events::emit_mirroring_failed(&self.bread_client, &device.id, &format!("{e:#}"));
let _ = reply.send(Err(format!("{e:#}")));
}
}
return;
@ -184,8 +187,8 @@ impl Daemon {
let _ = reply.send(Ok(()));
}
Err(e) => {
bread_events::emit_mirroring_failed(&self.bread_client, &device.url, &e.to_string());
let _ = reply.send(Err(e.to_string()));
bread_events::emit_mirroring_failed(&self.bread_client, &device.url, &format!("{e:#}"));
let _ = reply.send(Err(format!("{e:#}")));
}
}
return;