]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/SendCommand.java
Update libsignal-service-java
[signal-cli] / src / main / java / org / asamk / signal / commands / SendCommand.java
index a1e4c2963d2cb3bbf195e9c7a4ccb4ac654354a3..7ab445fc378bb914843095ae94f0d106a5b138f2 100644 (file)
@@ -17,6 +17,7 @@ import org.asamk.signal.manager.Manager;
 import org.asamk.signal.manager.api.Message;
 import org.asamk.signal.manager.api.RecipientIdentifier;
 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;
@@ -84,7 +85,8 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
                 m.sendEndSessionMessage(singleRecipients);
                 return;
             } catch (IOException e) {
-                throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+                throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                        .getSimpleName() + ")");
             }
         }
 
@@ -107,8 +109,9 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
             outputResult(outputWriter, results.getTimestamp());
             ErrorUtils.handleSendMessageResults(results.getResults());
         } catch (AttachmentInvalidException | IOException e) {
-            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
-        } catch (GroupNotFoundException | NotAGroupMemberException e) {
+            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")");
+        } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new UserErrorException(e.getMessage());
         }
     }
@@ -140,9 +143,11 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
                 signal.sendEndSessionMessage(recipients);
                 return;
             } catch (Signal.Error.UntrustedIdentity e) {
-                throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
+                throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                        .getSimpleName() + ")");
             } catch (DBusExecutionException e) {
-                throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+                throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                        .getSimpleName() + ")");
             }
         }
 
@@ -181,7 +186,8 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
                 outputResult(outputWriter, timestamp);
                 return;
             } catch (Signal.Error.UntrustedIdentity e) {
-                throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
+                throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                        .getSimpleName() + ")");
             } catch (DBusExecutionException e) {
                 throw new UnexpectedErrorException("Failed to send note to self message: " + e.getMessage());
             }
@@ -193,9 +199,11 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
         } 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());
+            throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")");
         } catch (DBusExecutionException e) {
-            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage());
+            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")");
         }
     }