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

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new b9819219c Display the path in the open GCS credentials error (#4124)
b9819219c is described below

commit b9819219c8fb6c7e5c7336e3c2fcd86cb5befd98
Author: Xin Hao <[email protected]>
AuthorDate: Wed Apr 26 06:11:39 2023 +0800

    Display the path in the open GCS credentials error (#4124)
---
 object_store/src/gcp/credential.rs | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/object_store/src/gcp/credential.rs 
b/object_store/src/gcp/credential.rs
index a8dce7132..057e01333 100644
--- a/object_store/src/gcp/credential.rs
+++ b/object_store/src/gcp/credential.rs
@@ -29,14 +29,17 @@ use snafu::{ResultExt, Snafu};
 use std::env;
 use std::fs::File;
 use std::io::BufReader;
-use std::path::Path;
+use std::path::{Path, PathBuf};
 use std::time::{Duration, Instant};
 use tracing::info;
 
 #[derive(Debug, Snafu)]
 pub enum Error {
-    #[snafu(display("Unable to open service account file: {}", source))]
-    OpenCredentials { source: std::io::Error },
+    #[snafu(display("Unable to open service account file from {}: {}", 
path.display(), source))]
+    OpenCredentials {
+        source: std::io::Error,
+        path: PathBuf,
+    },
 
     #[snafu(display("Unable to decode service account file: {}", source))]
     DecodeCredentials { source: serde_json::Error },
@@ -233,7 +236,9 @@ fn read_credentials_file<T>(
 where
     T: serde::de::DeserializeOwned,
 {
-    let file = File::open(service_account_path).context(OpenCredentialsSnafu)?;
+    let file = File::open(&service_account_path).context(OpenCredentialsSnafu {
+        path: service_account_path.as_ref().to_owned(),
+    })?;
     let reader = BufReader::new(file);
     serde_json::from_reader(reader).context(DecodeCredentialsSnafu)
 }

Reply via email to