Handle "no sender available" error code from registration service

This commit is contained in:
Ameya Lokare
2026-06-17 12:22:38 -07:00
committed by Jon Chambers
parent fe0956c8f7
commit 911feceacb
3 changed files with 11 additions and 0 deletions
@@ -183,6 +183,8 @@ public class RegistrationServiceClient implements Managed {
RegistrationServiceSenderException.unknown(response.getError().getMayRetry()));
case SEND_VERIFICATION_CODE_ERROR_TYPE_TRANSPORT_NOT_ALLOWED -> throw new CompletionException(
new TransportNotAllowedException(buildSessionResponseFromMetadata(response.getSessionMetadata())));
case SEND_VERIFICATION_CODE_ERROR_NO_SENDER_AVAILABLE -> throw new CompletionException(
RegistrationServiceSenderException.unavailable(response.getError().getMayRetry()));
default -> throw new CompletionException(
new RuntimeException("Failed to send verification code: " + response.getError().getErrorType()));
@@ -28,6 +28,10 @@ public class RegistrationServiceSenderException extends Exception {
return new RegistrationServiceSenderException(Reason.PROVIDER_UNAVAILABLE, permanent);
}
public static RegistrationServiceSenderException unavailable(final boolean permanent) {
return new RegistrationServiceSenderException(Reason.PROVIDER_UNAVAILABLE, permanent);
}
private RegistrationServiceSenderException(final Reason reason, final boolean permanent) {
super(null, null, true, false);
this.reason = reason;
@@ -345,6 +345,11 @@ enum SendVerificationCodeErrorType {
*/
SEND_VERIFICATION_CODE_ERROR_TYPE_SUSPECTED_FRAUD = 7;
/**
* No senders are available for the requested region/transport
*/
SEND_VERIFICATION_CODE_ERROR_NO_SENDER_AVAILABLE = 8;
}
message CheckVerificationCodeRequest {