X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/467a48bac508b56f84dce7ee0b81a22fd0d32161..2e01a05e7110b4f94abb10489a28b73d9f4be9c0:/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..7ab445fc 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() + ")"); } } @@ -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() + ")"); } }