Skip to content

Commit

Permalink
Drop xet_error. (#134)
Browse files Browse the repository at this point in the history
xet_error was a source drop of thiserror with integrated logging and the ability to put in a breakpoint to note exception propagation. However, the benefits of maintaining a source drop with changes, at least on client side, are less clear in the current ecosystem and with upgrades to the thiserror package (e.g. better integrated stacktracing).

This PR removes xet_error and reverts everything back to the original thiserror implementation.
  • Loading branch information
hoytak authored Jan 9, 2025
1 parent d88a88a commit 196e8c8
Show file tree
Hide file tree
Showing 139 changed files with 85 additions and 5,565 deletions.
207 changes: 53 additions & 154 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ members = [
"parutils",
"progress_reporting",
"utils",
"xet_error",
"cas_object",
"cas_types",
"chunk_cache",
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Xet-core is the repo responsible for Rust-based code running on the client machi
* [parutils](src/parutils): Provides parallel execution utilities relying on Tokio (ex. parallel foreach).
* [progress_reporting](src/progress_reporting): offers ReportedWriter so progress for Writer operations can be displayed.
* [utils](src/utils): general utilities - **unclear how much is currently in use**
* [xet_error](src/xet_error): Error utility crate, widely used for anyhow! logging in other crates.

## Local Development

Expand Down
2 changes: 1 addition & 1 deletion cas_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ utils = { path = "../utils" }
merkledb = { path = "../merkledb" }
mdb_shard = { path = "../mdb_shard" }
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
tokio = { version = "1.41", features = ["full"] }
async-trait = "0.1.9"
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion cas_client/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use merklehash::MerkleHash;
use xet_error::Error;
use thiserror::Error;

#[non_exhaustive]
#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion cas_object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
xet_error = { path = "../xet_error" }
thiserror = "2.0"
error_printer = { path = "../error_printer" }
merkledb = { path = "../merkledb" }
merklehash = { path = "../merklehash" }
Expand Down
2 changes: 1 addition & 1 deletion cas_object/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::convert::Infallible;

use thiserror::Error;
use tracing::warn;
use xet_error::Error;

#[non_exhaustive]
#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion cas_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"

[dependencies]
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
serde = { version = "1.0.208", features = ["derive"] }
serde_repr = "0.1.19"
2 changes: 1 addition & 1 deletion cas_types/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use xet_error::Error;
use thiserror::Error;

#[non_exhaustive]
#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion chunk_cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
cas_types = { path = "../cas_types" }
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
error_printer = { path = "../error_printer" }
file_utils = { path = "../file_utils" }
utils = { path = "../utils" }
Expand Down
2 changes: 1 addition & 1 deletion chunk_cache/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::str::Utf8Error;

use base64::DecodeError;
use merklehash::DataHashBytesParseError;
use xet_error::Error;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum ChunkCacheError {
Expand Down
8 changes: 4 additions & 4 deletions chunk_cache_bench/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ utils = { path = "../utils" }
parutils = { path = "../parutils" }
file_utils = { path = "../file_utils" }
error_printer = { path = "../error_printer" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
tokio = { version = "1.36", features = ["full"] }
anyhow = "1"
tracing = "0.1.*"
Expand Down
5 changes: 3 additions & 2 deletions data/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use std::sync::mpsc::RecvError;
use cas_client::CasClientError;
use mdb_shard::error::MDBShardError;
use merkledb::error::MerkleDBError;
use thiserror::Error;
use tracing::error;
use utils::errors::{AuthError, SingleflightError};
use xet_error::Error;

#[derive(Error, Debug)]
pub enum DataProcessingError {
Expand Down Expand Up @@ -79,7 +80,7 @@ pub type Result<T> = std::result::Result<T, DataProcessingError>;
impl From<SingleflightError<DataProcessingError>> for DataProcessingError {
fn from(value: SingleflightError<DataProcessingError>) -> Self {
let msg = format!("{value:?}");
xet_error::error_hook(&msg);
error!("{msg}");
match value {
SingleflightError::InternalError(e) => e,
_ => DataProcessingError::InternalError(format!("SingleflightError: {msg}")),
Expand Down
18 changes: 9 additions & 9 deletions hf_xet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mdb_shard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
utils = { path = "../utils" }
tempdir = "0.3.7"
tokio = { version = "1.36", features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion mdb_shard/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io;

use merklehash::MerkleHash;
use xet_error::Error;
use thiserror::Error;

#[non_exhaustive]
#[derive(Error, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion merkledb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ doctest = false

[dependencies]
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
parutils = { path = "../parutils" }
rand = "0.8.5"
rand_core = "0.6.3"
Expand Down
2 changes: 1 addition & 1 deletion merkledb/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io;

use xet_error::Error;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum MerkleDBError {
Expand Down
2 changes: 1 addition & 1 deletion utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ path = "src/lib.rs"

[dependencies]
merklehash = { path = "../merklehash" }
xet_error = { path = "../xet_error" }
thiserror = "2.0"
futures = "0.3.28"

# singleflight & threadpool
Expand Down
2 changes: 1 addition & 1 deletion utils/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use xet_error::Error;
use thiserror::Error;

#[derive(Debug, Error)]
#[non_exhaustive]
Expand Down
2 changes: 1 addition & 1 deletion utils/src/threadpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::future::Future;
use std::sync::atomic::Ordering::SeqCst;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};

use thiserror::Error;
/// This module provides a simple wrapper around Tokio's runtime to create a thread pool
/// with some default settings. It is intended to be used as a singleton thread pool for
/// the entire application.
Expand Down Expand Up @@ -52,7 +53,6 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use tokio;
use tokio::task::{JoinError, JoinHandle};
use tracing::{debug, error};
use xet_error::Error;

const THREADPOOL_NUM_WORKER_THREADS: usize = 4; // 4 active threads
const THREADPOOL_THREAD_ID_PREFIX: &str = "hf-xet"; // thread names will be hf-xet-0, hf-xet-1, etc.
Expand Down
105 changes: 0 additions & 105 deletions xet_error/.github/workflows/ci.yml

This file was deleted.

Loading

0 comments on commit 196e8c8

Please sign in to comment.