File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -674,12 +674,19 @@ impl ErrorMetadataAnyhowExt for anyhow::Error {
674674 let as_string = self . to_string ( ) ;
675675 // Just doing this as a quick hack because sqlx::query has 100 throw sites.
676676 // Ideally, we would wrap sqlx and do handling there, but punting to save time.
677- let occs = [
677+ let postgres_occs = [
678678 "could not serialize access due to read/write dependencies among transactions" ,
679679 "could not serialize access due to concurrent update" ,
680680 ] ;
681- if occs. into_iter ( ) . any ( |occ| as_string. contains ( occ) ) {
682- return self . context ( ErrorMetadata :: system_occ ( ) ) . context ( as_string) ;
681+ if let Some ( occ) = postgres_occs
682+ . into_iter ( )
683+ . find ( |occ| as_string. contains ( occ) )
684+ {
685+ // Classify postgres occ as overloaded. ErrorMetadata::OCC is specific to the
686+ // application level inside convex backend.
687+ return self
688+ . context ( ErrorMetadata :: overloaded ( "PostgresOcc" , occ) )
689+ . context ( as_string) ;
683690 }
684691
685692 self
You can’t perform that action at this time.
0 commit comments