mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Include proof required information in sending error
This commit is contained in:
parent
2016cf2a5f
commit
f445cfb5c1
1 changed files with 13 additions and 0 deletions
|
@ -6,9 +6,11 @@ import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.whispersystems.signalservice.api.messages.SendMessageResult;
|
import org.whispersystems.signalservice.api.messages.SendMessageResult;
|
||||||
|
import org.whispersystems.signalservice.api.push.exceptions.ProofRequiredException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ErrorUtils {
|
public class ErrorUtils {
|
||||||
|
|
||||||
|
@ -46,6 +48,17 @@ public class ErrorUtils {
|
||||||
return String.format("Unregistered user \"%s\"", result.getAddress().getLegacyIdentifier());
|
return String.format("Unregistered user \"%s\"", result.getAddress().getLegacyIdentifier());
|
||||||
} else if (result.getIdentityFailure() != null) {
|
} else if (result.getIdentityFailure() != null) {
|
||||||
return String.format("Untrusted Identity for \"%s\"", result.getAddress().getLegacyIdentifier());
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue