Commit 6c55602 1 parent e4ef19c commit 6c55602 Copy full SHA for 6c55602
File tree 1 file changed +9
-17
lines changed
editoast/editoast_models/src
1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -37,20 +37,9 @@ fn try_parse_unique_violation(
37
37
value : captures. get ( 2 ) . unwrap ( ) . as_str ( ) . to_owned ( ) ,
38
38
} )
39
39
} else {
40
- tracing:: error!(
41
- ?RE ,
42
- error = e. message( ) ,
43
- details = e. details( ) ,
44
- "failed to parse PostgreSQL details message"
45
- ) ;
46
40
None
47
41
}
48
42
} else {
49
- tracing:: error!(
50
- ?RE ,
51
- error = e. message( ) ,
52
- "failed to parse PostgreSQL error message"
53
- ) ;
54
43
None
55
44
}
56
45
}
@@ -67,11 +56,6 @@ fn try_parse_check_violation(e: &Box<dyn DatabaseErrorInformation + Send + Sync>
67
56
. to_owned ( ) ,
68
57
} )
69
58
} else {
70
- tracing:: error!(
71
- ?RE ,
72
- error = e. message( ) ,
73
- "failed to parse PostgreSQL error message"
74
- ) ;
75
59
None
76
60
}
77
61
}
@@ -80,14 +64,22 @@ impl From<diesel::result::Error> for Error {
80
64
fn from ( e : diesel:: result:: Error ) -> Self {
81
65
match & e {
82
66
diesel:: result:: Error :: DatabaseError ( DatabaseErrorKind :: UniqueViolation , inner) => {
83
- try_parse_unique_violation ( inner) . unwrap_or_else ( || {
67
+ try_parse_unique_violation ( inner) . unwrap_or_else ( move || {
84
68
// falling back to the generic error — since it's still semantically correct, logging the error is enough
69
+ tracing:: error!(
70
+ error = %e,
71
+ "failed to parse PostgreSQL details message"
72
+ ) ;
85
73
Self :: DatabaseError ( e)
86
74
} )
87
75
}
88
76
diesel:: result:: Error :: DatabaseError ( DatabaseErrorKind :: CheckViolation , inner) => {
89
77
try_parse_check_violation ( inner) . unwrap_or_else ( || {
90
78
// falling back to the generic error — since it's still semantically correct, logging the error is enough
79
+ tracing:: error!(
80
+ error = %e,
81
+ "failed to parse PostgreSQL details message"
82
+ ) ;
91
83
Self :: DatabaseError ( e)
92
84
} )
93
85
}
You can’t perform that action at this time.
0 commit comments