Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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