Re-raise InvalidPrivsError when granting privileges

This commit is contained in:
R.Sicart 2021-11-01 16:07:37 +01:00
parent ce3f7065a9
commit c8d93c796f
3 changed files with 6 additions and 3 deletions

View file

@ -644,7 +644,10 @@ def privileges_grant(cursor, user, host, db_table, priv, tls_requires, maria_rol
if 'GRANT' in priv:
query.append("WITH GRANT OPTION")
query = ' '.join(query)
cursor.execute(query, params)
try:
cursor.execute(query, params)
except (mysql_driver.ProgrammingError, mysql_driver.OperationalError, mysql_driver.InternalError) as e:
raise InvalidPrivsError("Error granting privileges, invalid priv string: %s" % priv_string) from e
def convert_priv_dict_to_str(priv):