X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/2016cf2a5fdf83310d78ca1672a313884880f26e..f445cfb5c16ff0de5c96a9f96f5213e2cf5e770f:/src/main/java/org/asamk/signal/util/ErrorUtils.java diff --git a/src/main/java/org/asamk/signal/util/ErrorUtils.java b/src/main/java/org/asamk/signal/util/ErrorUtils.java index 100368f6..2442ddb6 100644 --- a/src/main/java/org/asamk/signal/util/ErrorUtils.java +++ b/src/main/java/org/asamk/signal/util/ErrorUtils.java @@ -6,9 +6,11 @@ import org.asamk.signal.commands.exceptions.IOErrorException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.whispersystems.signalservice.api.messages.SendMessageResult; +import org.whispersystems.signalservice.api.push.exceptions.ProofRequiredException; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; public class ErrorUtils { @@ -46,6 +48,17 @@ public class ErrorUtils { return String.format("Unregistered user \"%s\"", result.getAddress().getLegacyIdentifier()); } else if (result.getIdentityFailure() != null) { return String.format("Untrusted Identity for \"%s\"", result.getAddress().getLegacyIdentifier()); + } else if (result.getProofRequiredFailure() != null) { + final var failure = result.getProofRequiredFailure(); + return String.format( + "CAPTCHA proof required for sending to \"%s\", available options \"%s\" with token \"%s\", or wait \"%d\" seconds", + result.getAddress().getLegacyIdentifier(), + failure.getOptions() + .stream() + .map(ProofRequiredException.Option::toString) + .collect(Collectors.joining(", ")), + failure.getToken(), + failure.getRetryAfterSeconds()); } return null; }