Handle rate limit exception correctly when querying usernames

Fixes #1797
This commit is contained in:
AsamK 2025-07-12 11:03:28 +02:00
parent a96626c468
commit ca33249170
5 changed files with 34 additions and 14 deletions

View file

@ -64,9 +64,16 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
}
final var usernames = ns.<String>getList("username");
final var registeredUsernames = usernames == null
? Map.<String, UsernameStatus>of()
: m.getUsernameStatus(new HashSet<>(usernames));
final Map<String, UsernameStatus> registeredUsernames;
try {
registeredUsernames = usernames == null ? Map.of() : m.getUsernameStatus(new HashSet<>(usernames));
} catch (IOException e) {
throw new IOErrorException("Unable to check if users are registered: "
+ e.getMessage()
+ " ("
+ e.getClass().getSimpleName()
+ ")", e);
}
// Output
switch (outputWriter) {