use already exists exceptions always with an appropriate message

This commit is contained in:
Sebastian Sdorra
2016-12-07 22:40:24 +01:00
parent 3709ce7602
commit 64581e1f75
5 changed files with 39 additions and 25 deletions

View File

@@ -171,7 +171,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
if (repositoryDAO.contains(repository))
{
throw new RepositoryAlreadyExistsException();
throw RepositoryAlreadyExistsException.create(repository);
}
repository.setId(keyGenerator.createKey());

View File

@@ -159,7 +159,7 @@ public class DefaultUserManager extends AbstractUserManager
if (userDAO.contains(user.getName()))
{
throw new UserAlreadyExistsException(user.getName());
throw new UserAlreadyExistsException(user.getName().concat(" user already exists"));
}
AssertUtil.assertIsValid(user);