Preserve legacy registration API error handling

This commit is contained in:
Jon Chambers 2023-01-31 11:02:18 -05:00 committed by Jon Chambers
parent 515a863195
commit 448365c7a0
1 changed files with 10 additions and 2 deletions

View File

@ -967,7 +967,12 @@ public class AccountController {
return registrationServiceClient.createRegistrationSession(phoneNumber, REGISTRATION_RPC_TIMEOUT).join();
} catch (final CompletionException e) {
rethrowRateLimitException(e);
throw e;
logger.debug("Failed to create session", e);
// Meet legacy client expectations by "swallowing" session creation exceptions and proceeding as if we had created
// a new session. Future operations on this "session" will always fail, but that's the legacy behavior.
return new byte[16];
}
}
@ -983,8 +988,11 @@ public class AccountController {
acceptLanguage.orElse(null),
REGISTRATION_RPC_TIMEOUT).join();
} catch (final CompletionException e) {
// Note that, to meet legacy client expectations, we'll ONLY rethrow rate limit exceptions. All others will be
// swallowed silently.
rethrowRateLimitException(e);
throw e;
logger.debug("Failed to send verification code", e);
}
}