- var timestamp = signal.sendMessage(messageText, attachments, recipients);
- outputResult(outputWriter, timestamp);
- } catch (UnknownObject e) {
- throw new UserErrorException("Failed to find dbus object, maybe missing the -u flag: " + e.getMessage());
- } catch (Signal.Error.UntrustedIdentity e) {
- throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
- } catch (DBusExecutionException e) {
- throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+ var results = m.sendMessage(new Message(messageText,
+ attachments,
+ mentions,
+ Optional.ofNullable(quote),
+ Optional.ofNullable(sticker),
+ previews), recipientIdentifiers);
+ outputResult(outputWriter, results);
+ } catch (AttachmentInvalidException | IOException e) {
+ throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+ .getSimpleName() + ")", e);
+ } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
+ throw new UserErrorException(e.getMessage());
+ } catch (UnregisteredRecipientException e) {
+ throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered.");
+ } catch (InvalidStickerException e) {
+ throw new UserErrorException("Failed to send sticker: " + e.getMessage(), e);