Skip to content

Commit

Permalink
Bumped error_stack, exposed from crate to prevent needing to depend d…
Browse files Browse the repository at this point in the history
…ownstream anymore
  • Loading branch information
zakstucke committed Aug 12, 2024
1 parent c2a5019 commit 16e8988
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions rust/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 rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ all-features = true
[dependencies]
parking_lot = { version = "0.12", features = ["serde"] }
tracing = "0.1"
error-stack = "0.4"
error-stack = { version = "0.5", features = ["anyhow", "serde"] }
colored = '2'
tracing-subscriber = { version = "0.3", features = ["fmt", "std", "time"] }
serde = { version = "1", features = ["derive", "rc"] }
Expand Down
12 changes: 6 additions & 6 deletions rust/bitbazaar/errors/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
#[macro_export]
macro_rules! anyerr {
() => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;
use $crate::errors::AnyErr;

Report::new(AnyErr)
}};

($str:expr) => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;
use $crate::errors::AnyErr;

Report::new(AnyErr).attach_printable($str)
}};

($str:expr, $($arg:expr),*) => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;
use $crate::errors::AnyErr;

Report::new(AnyErr).attach_printable(format!($str, $($arg),*))
Expand All @@ -39,19 +39,19 @@ macro_rules! anyerr {
#[macro_export]
macro_rules! err {
($err_variant:expr) => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;

Report::new($err_variant)
}};

($err_variant:expr, $str:expr) => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;

Report::new($err_variant).attach_printable($str)
}};

($err_variant:expr, $str:expr, $($arg:expr),*) => {{
use error_stack::Report;
use $crate::errors::error_stack::Report;

Report::new($err_variant).attach_printable(format!($str, $($arg),*))
}};
Expand Down
3 changes: 3 additions & 0 deletions rust/bitbazaar/errors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mod any;
mod macros;

/// Publicly exporting the error stack crate, to prevent every dependent depending on it too.
pub use error_stack;

pub use any::AnyErr;

/// Shorthand for a [`Result`] with a [`error_stack::Report`] as the error variant
Expand Down

0 comments on commit 16e8988

Please sign in to comment.