handle new RegistrationService proto error

This commit is contained in:
Ravi Khadiwala
2023-12-19 13:37:04 -06:00
committed by ravi-signal
parent 9d3d4a3698
commit ca47a7b663
8 changed files with 102 additions and 6 deletions

View File

@@ -0,0 +1,12 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.registration;
public class RegistrationFraudException extends Exception {
public RegistrationFraudException(final RegistrationServiceSenderException cause) {
super(null, cause, true, false);
}
}

View File

@@ -146,6 +146,9 @@ public class RegistrationServiceClient implements Managed {
case SEND_VERIFICATION_CODE_ERROR_TYPE_SENDER_REJECTED -> throw new CompletionException(
RegistrationServiceSenderException.rejected(response.getError().getMayRetry()));
case SEND_VERIFICATION_CODE_ERROR_TYPE_SUSPECTED_FRAUD ->
throw new CompletionException(new RegistrationFraudException(
RegistrationServiceSenderException.rejected(response.getError().getMayRetry())));
case SEND_VERIFICATION_CODE_ERROR_TYPE_SENDER_ILLEGAL_ARGUMENT -> throw new CompletionException(
RegistrationServiceSenderException.illegalArgument(response.getError().getMayRetry()));
case SEND_VERIFICATION_CODE_ERROR_TYPE_UNSPECIFIED -> throw new CompletionException(