]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/SendReactionCommand.java
Refactor Manager interface
[signal-cli] / src / main / java / org / asamk / signal / commands / SendReactionCommand.java
index c8e339a10073fe3e8292f782b81f5a150f63c7fe..f8c3c358183f819a124cb56d78ced8ce82aca18e 100644 (file)
@@ -13,6 +13,7 @@ import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
 import org.asamk.signal.commands.exceptions.UserErrorException;
 import org.asamk.signal.manager.Manager;
 import org.asamk.signal.manager.groups.GroupNotFoundException;
+import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
 import org.asamk.signal.manager.groups.NotAGroupMemberException;
 import org.asamk.signal.util.CommandUtil;
 import org.asamk.signal.util.ErrorUtils;
@@ -71,15 +72,16 @@ public class SendReactionCommand implements DbusCommand, JsonRpcLocalCommand {
         try {
             final var results = m.sendMessageReaction(emoji,
                     isRemove,
-                    CommandUtil.getSingleRecipientIdentifier(targetAuthor, m.getUsername()),
+                    CommandUtil.getSingleRecipientIdentifier(targetAuthor, m.getSelfNumber()),
                     targetTimestamp,
                     recipientIdentifiers);
             outputResult(outputWriter, results.getTimestamp());
             ErrorUtils.handleSendMessageResults(results.getResults());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new UserErrorException(e.getMessage());
         } catch (IOException e) {
-            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")", e);
         }
     }
 
@@ -126,7 +128,8 @@ public class SendReactionCommand implements DbusCommand, JsonRpcLocalCommand {
         } catch (Signal.Error.GroupNotFound e) {
             throw new UserErrorException("Failed to send to group: " + e.getMessage());
         } catch (DBusExecutionException e) {
-            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")", e);
         }
     }