add another case to the exception message regex

This commit is contained in:
Ruby Rose 2018-09-23 14:29:59 +03:00
parent e08ba6b362
commit 4df8a6f38f

View file

@ -76,7 +76,7 @@ namespace TShockAPI.DB
catch (Exception ex)
{
// Detect duplicate user using a regexp as Sqlite doesn't have well structured exceptions
if (Regex.IsMatch(ex.Message, "Username.*not unique"))
if (Regex.IsMatch(ex.Message, "Username.*not unique|UNIQUE constraint failed: Users\\.Username"))
throw new UserAccountExistsException(account.Name);
throw new UserAccountManagerException("AddUser SQL returned an error (" + ex.Message + ")", ex);
}