AccountManager: Include ID key in exception message when already in use
Change-Id: I786bf49c74b36bd314dfff81f86a3df09c341489
This commit is contained in:
@@ -580,10 +580,11 @@ public class AccountIT extends AbstractDaemonTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void cannotAddEmailAddressUsedByAnotherAccount() throws Exception {
|
public void cannotAddEmailAddressUsedByAnotherAccount() throws Exception {
|
||||||
EmailInput input = newEmailInput("new.email@example.com");
|
String email = "new.email@example.com";
|
||||||
|
EmailInput input = newEmailInput(email);
|
||||||
gApi.accounts().self().addEmail(input);
|
gApi.accounts().self().addEmail(input);
|
||||||
exception.expect(ResourceConflictException.class);
|
exception.expect(ResourceConflictException.class);
|
||||||
exception.expectMessage("in use by another account");
|
exception.expectMessage("Identity 'mailto:" + email + "' in use by another account");
|
||||||
gApi.accounts().id(user.username).addEmail(input);
|
gApi.accounts().id(user.username).addEmail(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,8 @@ public class AccountManager {
|
|||||||
ExternalId extId = externalIds.get(who.getExternalIdKey());
|
ExternalId extId = externalIds.get(who.getExternalIdKey());
|
||||||
if (extId != null) {
|
if (extId != null) {
|
||||||
if (!extId.accountId().equals(to)) {
|
if (!extId.accountId().equals(to)) {
|
||||||
throw new AccountException("Identity in use by another account");
|
throw new AccountException(
|
||||||
|
"Identity '" + extId.key().get() + "' in use by another account");
|
||||||
}
|
}
|
||||||
update(who, extId);
|
update(who, extId);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user