From 44e1051deed6be27dde0f63af56233f1956961a2 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Sat, 5 Dec 2020 14:45:37 -0500 Subject: [PATCH] Debug --- docker/Dockerfile.build | 2 +- zebrad/Cargo.toml | 2 +- zebrad/src/bin/zebrad/main.rs | 37 ++++++++++++++++++++++------------- zebrad/src/components/sync.rs | 2 -- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build index 48bd8cd5..05e78193 100644 --- a/docker/Dockerfile.build +++ b/docker/Dockerfile.build @@ -18,7 +18,7 @@ RUN rustc -V; cargo -V; rustup -V COPY . . -RUN cargo test --all --release; cd zebrad/; cargo build --release --features enable-sentry +RUN cd zebrad/; cargo build --release --features enable-sentry # Runner image diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index f57c126a..43cf1b7b 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -40,7 +40,7 @@ dirs = "3.0.1" inferno = { version = "0.10.2", default-features = false } atty = "0.2.14" -sentry = "0.21.0" +sentry = { version = "0.21.0", default-features = false, features = ["backtrace", "contexts", "panic", "reqwest", "rustls"] } sentry-tracing = { git = "https://github.com/kellpossible/sentry-tracing.git", rev = "f1a4a4a16b5ff1022ae60be779eb3fb928ce9b0f" } [build-dependencies] diff --git a/zebrad/src/bin/zebrad/main.rs b/zebrad/src/bin/zebrad/main.rs index af370dc6..6c4bf1c4 100644 --- a/zebrad/src/bin/zebrad/main.rs +++ b/zebrad/src/bin/zebrad/main.rs @@ -3,23 +3,32 @@ #![deny(warnings, missing_docs, trivial_casts, unused_qualifications)] #![forbid(unsafe_code)] -use zebrad::application::APPLICATION; +// use zebrad::application::APPLICATION; /// Boot Zebrad fn main() { - if cfg!(feature = "enable-sentry") { - let tracing_integration = sentry_tracing::TracingIntegration::default(); + // if cfg!(feature = "enable-sentry") { - // The Sentry default config pulls in the DSN from the `SENTRY_DSN` - // environment variable. - std::mem::forget(sentry::init( - sentry::ClientOptions { - debug: true, - ..Default::default() - } - .add_integration(tracing_integration), - )); - } + // The Sentry default config pulls in the DSN from the `SENTRY_DSN` + // environment variable. + let _guard = sentry::init( + sentry::ClientOptions { + debug: true, + ..Default::default() + }, // .add_integration(sentry_tracing::TracingIntegration::default()), + ); + // } - abscissa_core::boot(&APPLICATION); + let next = std::panic::take_hook(); + std::panic::set_hook(Box::new(move |info| { + println!("Caught panic"); + sentry::integrations::panic::panic_handler(info); + next(info); + })); + + sentry::capture_message("Hello World!", sentry::Level::Info); + + panic!("Everything is on fire!"); + + //abscissa_core::boot(&APPLICATION); } diff --git a/zebrad/src/components/sync.rs b/zebrad/src/components/sync.rs index ab193cfb..d49738db 100644 --- a/zebrad/src/components/sync.rs +++ b/zebrad/src/components/sync.rs @@ -254,8 +254,6 @@ where /// multiple peers #[instrument(skip(self))] async fn obtain_tips(&mut self) -> Result<(), Report> { - panic!("Everything is on fire!"); - let block_locator = self .state .ready_and()