From ecf14e1187590f8a4fc550a37bea649875266c15 Mon Sep 17 00:00:00 2001 From: xxchan Date: Mon, 14 Apr 2025 13:18:17 +0800 Subject: [PATCH] feat(cli): use fs_err to provide better err msg `cargo run --bin iceberg-cli` ICEBERG CLI v0.4.0 Error: No such file or directory (os error 2) After ICEBERG CLI v0.4.0 Error: failed to open file `/Users/xxchan/.icebergrc`: No such file or directory (os error 2) Signed-off-by: xxchan --- Cargo.lock | 10 ++++++++++ Cargo.toml | 7 ++++--- crates/integrations/cli/Cargo.toml | 1 + crates/integrations/cli/src/catalog.rs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b319e659ab..9e9a4bbad1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2534,6 +2534,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-err" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f89bda4c2a21204059a977ed3bfe746677dfd137b83c339e702b0ac91d482aa" +dependencies = [ + "autocfg", +] + [[package]] name = "funty" version = "2.0.0" @@ -3286,6 +3295,7 @@ dependencies = [ "datafusion", "datafusion-cli", "dirs", + "fs-err", "iceberg-catalog-rest", "iceberg-datafusion", "mimalloc", diff --git a/Cargo.toml b/Cargo.toml index 36d2d6e301..bfa7ea5c84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,15 +57,16 @@ aws-sdk-glue = "1.39" bimap = "0.6" bytes = "1.6" chrono = "0.4.38" -ctor = "0.2.8" clap = { version = "4.5.27", features = ["derive", "cargo"] } +ctor = "0.2.8" datafusion = "45" datafusion-cli = "45" derive_builder = "0.20" -expect-test = "1" dirs = "6" +expect-test = "1" faststr = "0.2.31" fnv = "1.0.7" +fs-err = "3.1.0" futures = "0.3" hive_metastore = "0.1" http = "1.1" @@ -104,10 +105,10 @@ tempfile = "3.18" tera = "1" thrift = "0.17.0" tokio = { version = "1.44", default-features = false } +toml = "0.8" tracing = "0.1.37" tracing-subscriber = "0.3.8" typed-builder = "0.20" -toml = "0.8" url = "2.5.4" uuid = { version = "1.14", features = ["v7"] } volo-thrift = "0.10" diff --git a/crates/integrations/cli/Cargo.toml b/crates/integrations/cli/Cargo.toml index 72afaf4c01..a9c6e45433 100644 --- a/crates/integrations/cli/Cargo.toml +++ b/crates/integrations/cli/Cargo.toml @@ -40,6 +40,7 @@ tracing-subscriber = {workspace = true} dirs = {workspace = true} stacker = {workspace = true} mimalloc = {workspace = true} +fs-err = {workspace = true} [package.metadata.cargo-machete] # These dependencies are added to ensure minimal dependency version diff --git a/crates/integrations/cli/src/catalog.rs b/crates/integrations/cli/src/catalog.rs index a1302c0304..e9450f13fe 100644 --- a/crates/integrations/cli/src/catalog.rs +++ b/crates/integrations/cli/src/catalog.rs @@ -17,12 +17,12 @@ use std::any::Any; use std::collections::HashMap; -use std::fs::read_to_string; use std::path::Path; use std::sync::Arc; use anyhow::anyhow; use datafusion::catalog::{CatalogProvider, CatalogProviderList}; +use fs_err::read_to_string; use iceberg_catalog_rest::{RestCatalog, RestCatalogConfig}; use iceberg_datafusion::IcebergCatalogProvider; use toml::{Table as TomlTable, Value};