Skip to content

Commit b653339

Browse files
authored
Merge pull request #319 from wuerges/master
Lower log level of events that are typically handled by application
2 parents 6c61bf9 + 8095ad1 commit b653339

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/tracing_utils.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,28 @@ macro_rules! instrument_result {
4444
($fut:expr, $span:expr) => {{
4545
let fut = async {
4646
$fut.await.or_else(|e| {
47-
tracing::error!(error = %e);
47+
match &e {
48+
$crate::error::Error::Server(server_error) => {
49+
match server_error.code {
50+
// Duplicated entry for key
51+
1062 => {
52+
tracing::warn!(error = %e)
53+
}
54+
// Foreign key violation
55+
1451 => {
56+
tracing::warn!(error = %e)
57+
}
58+
// User defined exception condition
59+
1644 => {
60+
tracing::warn!(error = %e);
61+
}
62+
_ => tracing::error!(error = %e),
63+
}
64+
},
65+
e => {
66+
tracing::error!(error = %e);
67+
}
68+
}
4869
Err(e)
4970
})
5071
};

0 commit comments

Comments
 (0)