]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/SendCommand.java
Refactor NoteToSelf to singleton class
[signal-cli] / src / main / java / org / asamk / signal / commands / SendCommand.java
index c29d02681d183ba63503a5597ee0867ebd859265..1973b1a106ca31a40de20574ec41b7b5c1444b17 100644 (file)
@@ -85,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() + ")", e);
             }
         }
 
@@ -108,7 +109,8 @@ 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());
+            throw new UnexpectedErrorException("Failed to send message: " + e.getMessage() + " (" + e.getClass()
+                    .getSimpleName() + ")", e);
         } catch (GroupNotFoundException | NotAGroupMemberException | GroupSendingNotAllowedException e) {
             throw new UserErrorException(e.getMessage());
         }
@@ -141,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() + ")", e);
             }
         }
 
@@ -172,7 +176,7 @@ public class SendCommand implements DbusCommand, JsonRpcLocalCommand {
                 outputResult(outputWriter, timestamp);
                 return;
             } catch (DBusExecutionException e) {
-                throw new UnexpectedErrorException("Failed to send group message: " + e.getMessage());
+                throw new UnexpectedErrorException("Failed to send group message: " + e.getMessage(), e);
             }
         }
 
@@ -182,9 +186,10 @@ 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());
+                throw new UnexpectedErrorException("Failed to send note to self message: " + e.getMessage(), e);
             }
         }
 
@@ -194,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() + ")", e);
         }
     }