Don't catch the exceptions we throw in SetUserGroup
For some reason, we were catching our own exceptions and then throwing UesrManagerExceptions despite the fact that we explicitly threw more specific exceptions. Fixes #1315.
This commit is contained in:
parent
6151c86630
commit
b15dfbc1ec
2 changed files with 8 additions and 7 deletions
|
|
@ -158,15 +158,15 @@ namespace TShockAPI.DB
|
|||
/// <param name="group">string group</param>
|
||||
public void SetUserGroup(User user, string group)
|
||||
{
|
||||
Group grp = TShock.Groups.GetGroupByName(group);
|
||||
if (null == grp)
|
||||
throw new GroupNotExistsException(group);
|
||||
|
||||
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", group, user.Name) == 0)
|
||||
throw new UserNotExistException(user.Name);
|
||||
|
||||
try
|
||||
{
|
||||
Group grp = TShock.Groups.GetGroupByName(group);
|
||||
if (null == grp)
|
||||
throw new GroupNotExistsException(group);
|
||||
|
||||
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", group, user.Name) == 0)
|
||||
throw new UserNotExistException(user.Name);
|
||||
|
||||
// Update player group reference for any logged in player
|
||||
foreach (var player in TShock.Players.Where(p => p != null && p.User != null && p.User.Name == user.Name))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue