Skip to content

Commit

Permalink
fix: only capture 500 errors in sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
philbooth committed Nov 21, 2018
1 parent b12b07f commit b2935f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/db/error.rs
Expand Up @@ -65,7 +65,13 @@ impl From<Context<DbErrorKind>> 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
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/error.rs
Expand Up @@ -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()
}
}
};
Expand Down

0 comments on commit b2935f5

Please sign in to comment.