From 3fed10523fe0554919fad091980df957a57b6445 Mon Sep 17 00:00:00 2001 From: Phil Booth Date: Tue, 20 Nov 2018 12:16:07 +0000 Subject: [PATCH] fix(sentry): stop passing 4xx errors to Sentry --- src/types/error/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/types/error/mod.rs b/src/types/error/mod.rs index 61b1ba8..441e260 100644 --- a/src/types/error/mod.rs +++ b/src/types/error/mod.rs @@ -87,10 +87,16 @@ impl Fail for AppError { impl From for AppError { fn from(kind: AppErrorKind) -> AppError { + let capture_in_sentry = kind.http_status() == Status::InternalServerError; + let error = AppError { inner: Context::new(kind).into(), }; - sentry::integrations::failure::capture_fail(&error); + + if capture_in_sentry { + sentry::integrations::failure::capture_fail(&error); + } + error } }