Use more appropriate exception types when catching accounts without phone numbers

This commit is contained in:
Jon Chambers authored and Jon Chambers committed 2026-08-18 13:14:01 -04:00
1 parent bc7cd0cc95
commit 0786627bef
1 file changed
+1 -1
@@ -212,7 +212,7 @@ public class KeysGrpcService extends SimpleKeysGrpc.KeysImplBase {
final IdentityKey identityKey = switch (identityType) {
case ACI -> account.getAccountIdentityKey();
case PNI -> account.getPhoneNumberIdentityKey()
.orElseThrow(() -> new IllegalArgumentException("Account does not have a PNI identity key"));
.orElseThrow(() -> GrpcExceptions.invalidArguments("account does not have a PNI identity key"));
};
final UUID identifier = getIdentifier(account, identityType);