Fix error message when adding a reviewer that does not exist

If the name given for a reviewer does not match to a user the
code falls into trying to match a group. If it also does not
match a group, report that neither is found instead of saying
"Group Not Found:user@example.com".

Change-Id: I09fd4448508430faa4fdd893687f7a0def2e1141
This commit is contained in:
Shawn Pearce
2013-03-27 17:11:01 -04:00
parent b893ac82b9
commit 037551174b
3 changed files with 9 additions and 1 deletions

View File

@@ -129,7 +129,13 @@ public class PostReviewers implements RestModifyView<ChangeResource, Input> {
Account.Id accountId = accounts.parse(input.reviewer).getAccountId();
return putAccount(reviewerFactory.create(rsrc, accountId));
} catch (UnprocessableEntityException e) {
return putGroup(rsrc, input);
try {
return putGroup(rsrc, input);
} catch (UnprocessableEntityException e2) {
throw new UnprocessableEntityException(MessageFormat.format(
ChangeMessages.get().reviewerNotFound,
input.reviewer));
}
}
}