From b2935f581676cf9be4627cc6eeed278b7175a9a1 Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Wed, 21 Nov 2018 15:47:09 +0000 Subject: [PATCH 1/2] fix: only capture 500 errors in sentry --- src/db/error.rs | 8 +++++++- src/error.rs | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/db/error.rs b/src/db/error.rs index 1f29b3d020..1ce5e64baf 100644 --- a/src/db/error.rs +++ b/src/db/error.rs @@ -65,7 +65,13 @@ impl From> for DbError { _ => StatusCode::INTERNAL_SERVER_ERROR, }; - Self { inner, status } + let error = Self { inner, status }; + + if status == StatusCode::INTERNAL_SERVER_ERROR { + sentry::integrations::failure::capture_fail(&error); + } + + error } } diff --git a/src/error.rs b/src/error.rs index 7aeeb283fa..d4c80c5924 100644 --- a/src/error.rs +++ b/src/error.rs @@ -132,9 +132,7 @@ macro_rules! failure_boilerplate { impl From<$kind> for $error { fn from(kind: $kind) -> Self { - let error = Context::new(kind).into(); - sentry::integrations::failure::capture_fail(&error); - error + Context::new(kind).into() } } }; From 06f9f38e1dcd213ddf914aade53441ee780b2a98 Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Wed, 21 Nov 2018 15:49:22 +0000 Subject: [PATCH 2/2] chore: ensure sentry shows line numbers for release builds --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ca3fa8972f..f5eb54bce0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ authors = [ "Phil Jenvey ", ] +[profile.release] +# Enables line numbers in Sentry +debug = 1 + [dependencies] actix = "0.7" actix-web = "0.7.7"