From d7cff8fbaf7e654c379b456ebf576d305b735198 Mon Sep 17 00:00:00 2001 From: Max Sharnoff Date: Wed, 22 Sep 2021 14:51:14 -0700 Subject: [PATCH] Show more detailed query errors from postgres_backend (#651) anyhow uses the alternate formatting style ("{:#}") to display all of the causes of an error instead of the outermost context. Without this, there's less information available to figure out what's going on. It's probably too much to display in the compute node logs though, so it's better to leave that formatting as-is. --- zenith_utils/src/postgres_backend.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zenith_utils/src/postgres_backend.rs b/zenith_utils/src/postgres_backend.rs index f5fe2319f3..b2e0a1a525 100644 --- a/zenith_utils/src/postgres_backend.rs +++ b/zenith_utils/src/postgres_backend.rs @@ -377,7 +377,11 @@ impl PostgresBackend { // xxx distinguish fatal and recoverable errors? if let Err(e) = handler.process_query(self, m.body.clone()) { let errmsg = format!("{}", e); - warn!("query handler for {:?} failed: {}", m.body, errmsg); + // ":#" uses the alternate formatting style, which makes anyhow display the + // full cause of the error, not just the top-level context. We don't want to + // send that in the ErrorResponse though, because it's not relevant to the + // compute node logs. + warn!("query handler for {:?} failed: {:#}", m.body, e); self.write_message_noflush(&BeMessage::ErrorResponse(errmsg))?; } self.write_message(&BeMessage::ReadyForQuery)?;