Skip to content

Commit

Permalink
cli: Remove direct initialization of eyre handler
Browse files Browse the repository at this point in the history
As long as Abscissa framework's Terminal component performs
eyre initialization under the hood and panics if it's already initialized,
the application should not do it. Unfortunately, Abscissa's initialization
of the error handler is directed only by terminal colorization choice,
which should be orthogonal to the user's preference for backtraces
in the reports.

Filed iqlusioninc/abscissa#589 to bring this
problem up to Abscissa's developers.
  • Loading branch information
mzabaluev committed Nov 19, 2021
1 parent 46c4329 commit 9b75c6d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
12 changes: 0 additions & 12 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions relayer-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ serde = { version = "1", features = ["serde_derive"] }
tokio = { version = "1.0", features = ["full"] }
tracing = "0.1.29"
tracing-subscriber = { version = "0.3.1", features = ["fmt", "env-filter", "json"]}
eyre = "0.6.5"
color-eyre = "0.5"
oneline-eyre = "0.1"
futures = "0.3.17"
toml = "0.5.8"
serde_derive = "1.0.116"
Expand Down
24 changes: 1 addition & 23 deletions relayer-cli/src/bin/hermes/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,6 @@

use ibc_relayer_cli::application::APPLICATION;

fn main() -> eyre::Result<()> {
install_error_reporter()?;

fn main() {
abscissa_core::boot(&APPLICATION);
}

fn install_error_reporter() -> eyre::Result<()> {
if !backtrace_enabled() {
// If backtraces are disabled, display errors in single line.
oneline_eyre::install()
} else {
// Otherwise, backtraces are enabled, so use the
// default error report handler. The impl for
// Application::framework_components takes care about
// initialization of color_eyre.
Ok(())
}
}

fn backtrace_enabled() -> bool {
match std::env::var("RUST_BACKTRACE").as_deref() {
Ok("" | "0") | Err(_) => false,
Ok(_) => true,
}
}

0 comments on commit 9b75c6d

Please sign in to comment.