]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/SendReceiptCommand.java
Add --mobilecoin-address as alias to updateProfile
[signal-cli] / src / main / java / org / asamk / signal / commands / SendReceiptCommand.java
index 1eec6c9947b8ac49ba4ac920161b11ab74910cb1..93c8a56401ddc018e5f76107d6863a13bc462e25 100644 (file)
@@ -10,8 +10,6 @@ import org.asamk.signal.manager.api.SendMessageResults;
 import org.asamk.signal.output.OutputWriter;
 import org.asamk.signal.util.CommandUtil;
 
-import java.io.IOException;
-
 import static org.asamk.signal.util.SendMessageResultUtils.outputResult;
 
 public class SendReceiptCommand implements JsonRpcLocalCommand {
@@ -37,7 +35,9 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
 
     @Override
     public void handleCommand(
-            final Namespace ns, final Manager m, final OutputWriter outputWriter
+            final Namespace ns,
+            final Manager m,
+            final OutputWriter outputWriter
     ) throws CommandException {
         final var recipientString = ns.getString("recipient");
         final var recipient = CommandUtil.getSingleRecipientIdentifier(recipientString, m.getSelfNumber());
@@ -45,19 +45,14 @@ public class SendReceiptCommand implements JsonRpcLocalCommand {
         final var targetTimestamps = ns.<Long>getList("target-timestamp");
         final var type = ns.getString("type");
 
-        try {
-            final SendMessageResults results;
-            if (type == null || "read".equals(type)) {
-                results = m.sendReadReceipt(recipient, targetTimestamps);
-            } else if ("viewed".equals(type)) {
-                results = m.sendViewedReceipt(recipient, targetTimestamps);
-            } else {
-                throw new UserErrorException("Unknown receipt type: " + type);
-            }
-            outputResult(outputWriter, results);
-        } catch (IOException e) {
-            throw new UserErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
-                    .getSimpleName() + ")");
+        final SendMessageResults results;
+        if (type == null || "read".equals(type)) {
+            results = m.sendReadReceipt(recipient, targetTimestamps);
+        } else if ("viewed".equals(type)) {
+            results = m.sendViewedReceipt(recipient, targetTimestamps);
+        } else {
+            throw new UserErrorException("Unknown receipt type: " + type);
         }
+        outputResult(outputWriter, results);
     }
 }