This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch fix-stat in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit bc903fc1c4403d4216ed302a449a8f809b9dd517 Author: Xuanwo <[email protected]> AuthorDate: Wed Nov 22 17:02:26 2023 +0800 Polish azfile Signed-off-by: Xuanwo <[email protected]> --- core/src/services/azfile/core.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/core/src/services/azfile/core.rs b/core/src/services/azfile/core.rs index 84fdc8a9f..4887051b1 100644 --- a/core/src/services/azfile/core.rs +++ b/core/src/services/azfile/core.rs @@ -34,6 +34,7 @@ use reqsign::AzureStorageLoader; use reqsign::AzureStorageSigner; use crate::raw::*; +use crate::services::azfile::error::parse_error; use crate::*; const X_MS_VERSION: &str = "x-ms-version"; @@ -423,21 +424,21 @@ impl AzfileCore { for dir in dirs { let resp = self.azfile_create_dir(dir).await?; - if resp.status() != StatusCode::CREATED { - if resp - .headers() - .get("x-ms-error-code") - .map(|value| value.to_str().unwrap_or("")) - .unwrap_or_else(|| "") - == "ResourceAlreadyExists" - { - continue; - } - return Err(Error::new( - ErrorKind::Unexpected, - format!("failed to create directory: {}", dir).as_str(), - )); + if resp.status() == StatusCode::CREATED { + continue; } + + if resp + .headers() + .get("x-ms-error-code") + .map(|value| value.to_str().unwrap_or("")) + .unwrap_or_else(|| "") + == "ResourceAlreadyExists" + { + continue; + } + + return Err(parse_error(resp)); } Ok(())
