File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 3636
3737logger = logging .getLogger (__name__ )
3838
39- postgresql_error_reg = re .compile (r'^ERROR: (.*)[\s+]+Position: ([0-9]+); SQLState: ([0-9A-Z]+)$' )
39+ postgresql_error_reg = re .compile (r'^ERROR:\s (.*)\s(?: [\s+]+Position:\s ([0-9]+);\s)? SQLState:\s ([0-9A-Z]+)$' )
4040
4141
4242class AuroraDataAPIClient :
@@ -219,7 +219,7 @@ def _get_database_error(self, origin_error):
219219 code , msg = (s .split (": " , 1 )[1 ] for s in error_msg .split (". " , 1 ))
220220 return DatabaseError (MySQLErrorCodes (int (code )), msg )
221221 elif error_msg .startswith ("ERROR: " ): # Postgresql error
222- msg , pos , code = postgresql_error_reg .match (error_msg ).groups ()
222+ msg , pos , code = postgresql_error_reg .match (error_msg . replace ( ' \n ' , '' ) ).groups ()
223223 return DatabaseError (PostgreSQLErrorCodes (code ), msg , pos )
224224 except Exception :
225225 pass
You can’t perform that action at this time.
0 commit comments