You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by xu...@apache.org on 2025/03/24 03:38:21 UTC

(iceberg-rust) branch add-headers-in-error created (now 8dbcac9a)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a change to branch add-headers-in-error
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


      at 8dbcac9a chore(catalog/rest): Add response headers in error for debug

This branch includes the following new commits:

     new 8dbcac9a chore(catalog/rest): Add response headers in error for debug

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iceberg-rust) 01/01: chore(catalog/rest): Add response headers in error for debug

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch add-headers-in-error
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git

commit 8dbcac9a9756fc4892d7ce629f1709c9d8cd6909
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Mon Mar 24 11:37:14 2025 +0800

    chore(catalog/rest): Add response headers in error for debug
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 crates/catalog/rest/src/client.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crates/catalog/rest/src/client.rs b/crates/catalog/rest/src/client.rs
index dde75276..75cd0bee 100644
--- a/crates/catalog/rest/src/client.rs
+++ b/crates/catalog/rest/src/client.rs
@@ -248,11 +248,14 @@ pub(crate) async fn deserialize_catalog_response<R: DeserializeOwned>(
 /// TODO: Eventually, this function should return an error response that is custom to the error
 /// codes that all endpoints share (400, 404, etc.).
 pub(crate) async fn deserialize_unexpected_catalog_error(response: Response) -> Error {
+    let (status, headers) = (response.status(), response.headers().clone());
     let bytes = match response.bytes().await {
         Ok(bytes) => bytes,
         Err(err) => return err.into(),
     };
 
     Error::new(ErrorKind::Unexpected, "Received unexpected response")
+        .with_context("status", status.to_string())
+        .with_context("headers", format!("{:?}", headers))
         .with_context("json", String::from_utf8_lossy(&bytes))
 }