Skip to content

Commit

Permalink
Merge pull request #319 from wuerges/master
Browse files Browse the repository at this point in the history
Lower log level of events that are typically handled by application
  • Loading branch information
blackbeam authored Dec 13, 2024
2 parents 6c61bf9 + 8095ad1 commit b653339
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/tracing_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,28 @@ macro_rules! instrument_result {
($fut:expr, $span:expr) => {{
let fut = async {
$fut.await.or_else(|e| {
tracing::error!(error = %e);
match &e {
$crate::error::Error::Server(server_error) => {
match server_error.code {
// Duplicated entry for key
1062 => {
tracing::warn!(error = %e)
}
// Foreign key violation
1451 => {
tracing::warn!(error = %e)
}
// User defined exception condition
1644 => {
tracing::warn!(error = %e);
}
_ => tracing::error!(error = %e),
}
},
e => {
tracing::error!(error = %e);
}
}
Err(e)
})
};
Expand Down

0 comments on commit b653339

Please sign in to comment.