+ if (!sendMessageResults.hasSuccess()) {
+ if (sendMessageResults.hasOnlyUntrustedIdentity()) {
+ throw new UntrustedKeyErrorException("Failed to send message due to untrusted identities");
+ } else {
+ throw new UserErrorException("Failed to send message");
+ }
+ }