mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Remove legacy EncapsulatedExceptions from manager
This commit is contained in:
parent
d94a7511dd
commit
a634b46eb2
5 changed files with 108 additions and 141 deletions
|
@ -9,18 +9,20 @@ import org.asamk.signal.manager.Manager;
|
|||
import org.asamk.signal.manager.NotAGroupMemberException;
|
||||
import org.asamk.signal.util.GroupIdFormatException;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
|
||||
import org.whispersystems.libsignal.util.Pair;
|
||||
import org.whispersystems.signalservice.api.messages.SendMessageResult;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleEncapsulatedExceptions;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleGroupIdFormatException;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleGroupNotFoundException;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleIOException;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleInvalidNumberException;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleNotAGroupMemberException;
|
||||
import static org.asamk.signal.util.ErrorUtils.handleTimestampAndSendMessageResults;
|
||||
|
||||
public class SendReactionCommand implements LocalCommand {
|
||||
|
||||
|
@ -66,19 +68,18 @@ public class SendReactionCommand implements LocalCommand {
|
|||
long targetTimestamp = ns.getLong("target_timestamp");
|
||||
|
||||
try {
|
||||
final Pair<Long, List<SendMessageResult>> results;
|
||||
if (ns.getString("group") != null) {
|
||||
byte[] groupId = Util.decodeGroupId(ns.getString("group"));
|
||||
m.sendGroupMessageReaction(emoji, isRemove, targetAuthor, targetTimestamp, groupId);
|
||||
results = m.sendGroupMessageReaction(emoji, isRemove, targetAuthor, targetTimestamp, groupId);
|
||||
} else {
|
||||
m.sendMessageReaction(emoji, isRemove, targetAuthor, targetTimestamp, ns.getList("recipient"));
|
||||
results = m.sendMessageReaction(emoji, isRemove, targetAuthor, targetTimestamp, ns.getList("recipient"));
|
||||
}
|
||||
handleTimestampAndSendMessageResults(results.first(), results.second());
|
||||
return 0;
|
||||
} catch (IOException e) {
|
||||
handleIOException(e);
|
||||
return 3;
|
||||
} catch (EncapsulatedExceptions e) {
|
||||
handleEncapsulatedExceptions(e);
|
||||
return 3;
|
||||
} catch (AssertionError e) {
|
||||
handleAssertionError(e);
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue