X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/467a48bac508b56f84dce7ee0b81a22fd0d32161..1856e79a507e97c523f40426e0e30c5c72b50ad7:/src/main/java/org/asamk/signal/commands/SendCommand.java diff --git a/src/main/java/org/asamk/signal/commands/SendCommand.java b/src/main/java/org/asamk/signal/commands/SendCommand.java index a1e4c296..1973b1a1 100644 --- a/src/main/java/org/asamk/signal/commands/SendCommand.java +++ b/src/main/java/org/asamk/signal/commands/SendCommand.java @@ -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() + ")", e); } } @@ -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() + ")", e); + } 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() + ")", e); } } @@ -171,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); } } @@ -181,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); } } @@ -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() + ")", e); } }