Skip to content

Commit 508bdd0

Browse files
committed
add except priority order
1 parent b4746e6 commit 508bdd0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

qiita_db/sql_connection.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ def _raise_execution_error(self, sql, sql_args, error):
198198
ec_lu = errorcodes.lookup(error.pgcode)
199199
raise ValueError(
200200
"Error running SQL: %s. MSG: %s\n" % (ec_lu, str(error)))
201-
except (KeyError, AttributeError, TypeError, ValueError):
201+
# the order of except statements is important, do not change
202+
except (KeyError, AttributeError, TypeError) as error:
203+
raise ValueError("Error running SQL query: %s" % str(error))
204+
except ValueError as error:
202205
raise ValueError("Error running SQL query: %s" % str(error))
203206

204207
@_checker

0 commit comments

Comments
 (0)