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" 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() } } };