+ throw new UserErrorException("Invalid group id: " + e.getMessage());
+ }
+
+ var groupAdmins = ns.<String>getList("admin");
+
+ try {
+ final var results = m.sendQuitGroupMessage(groupId,
+ groupAdmins == null ? Set.of() : new HashSet<>(groupAdmins));
+ handleTimestampAndSendMessageResults(writer, results.first(), results.second());
+ } catch (IOException e) {
+ throw new IOErrorException("Failed to send message: " + e.getMessage());
+ } catch (GroupNotFoundException | NotAGroupMemberException e) {
+ throw new UserErrorException("Failed to send to group: " + e.getMessage());
+ } catch (InvalidNumberException e) {
+ throw new UserErrorException("Failed to parse admin number: " + e.getMessage());
+ } catch (LastGroupAdminException e) {
+ throw new UserErrorException("You need to specify a new admin with --admin: " + e.getMessage());