From 911feceacbc00e6d9941e57c7b35eb8942bfabd8 Mon Sep 17 00:00:00 2001 From: Ameya Lokare Date: Wed, 17 Jun 2026 12:22:38 -0700 Subject: [PATCH] Handle "no sender available" error code from registration service --- .../registration/RegistrationServiceClient.java | 2 ++ .../registration/RegistrationServiceSenderException.java | 4 ++++ service/src/main/proto/RegistrationService.proto | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceClient.java b/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceClient.java index 09c64b59a..b53e9cd8c 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceClient.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceClient.java @@ -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())); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceSenderException.java b/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceSenderException.java index a2f9372ab..731b0701b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceSenderException.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/registration/RegistrationServiceSenderException.java @@ -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; diff --git a/service/src/main/proto/RegistrationService.proto b/service/src/main/proto/RegistrationService.proto index e1f9bc1f3..5c5643037 100644 --- a/service/src/main/proto/RegistrationService.proto +++ b/service/src/main/proto/RegistrationService.proto @@ -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 {