Skip to content

Commit

Permalink
Merge pull request #91 from mozilla-services/pb/sentry-fixes
Browse files Browse the repository at this point in the history
Two tiny tweaks for Sentry
  • Loading branch information
pjenvey authored Nov 21, 2018
2 parents b779bf5 + 06f9f38 commit 703939d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ authors = [
"Phil Jenvey <[email protected]>",
]

[profile.release]
# Enables line numbers in Sentry
debug = 1

[dependencies]
actix = "0.7"
actix-web = "0.7.7"
Expand Down
8 changes: 7 additions & 1 deletion src/db/error.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 703939d

Please sign in to comment.