From: AsamK Date: Thu, 31 Dec 2015 11:54:25 +0000 (+0100) Subject: Handle DBusExecutionExceptions X-Git-Tag: v0.2.1~6 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/239afa07e888642076e18854843c61e4921aa3ec Handle DBusExecutionExceptions --- diff --git a/src/main/java/org/asamk/textsecure/Main.java b/src/main/java/org/asamk/textsecure/Main.java index 2e694ffd..8a252b99 100644 --- a/src/main/java/org/asamk/textsecure/Main.java +++ b/src/main/java/org/asamk/textsecure/Main.java @@ -23,6 +23,7 @@ import org.apache.commons.io.IOUtils; import org.asamk.TextSecure; import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; import org.whispersystems.textsecure.api.crypto.UntrustedIdentityException; import org.whispersystems.textsecure.api.messages.*; import org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage; @@ -147,6 +148,8 @@ public class Main { handleEncapsulatedExceptions(e); } catch (AssertionError e) { handleAssertionError(e); + } catch (DBusExecutionException e) { + handleDBusExecutionException(e); } } else { String messageText = ns.getString("message"); @@ -183,6 +186,8 @@ public class Main { System.err.println("Failed to add attachment: " + e.getMessage()); System.err.println("Aborting sending."); System.exit(1); + } catch (DBusExecutionException e) { + handleDBusExecutionException(e); } } @@ -324,6 +329,12 @@ public class Main { System.exit(1); } + private static void handleDBusExecutionException(DBusExecutionException e) { + System.err.println("Cannot connect to dbus: " + e.getMessage()); + System.err.println("Aborting."); + System.exit(1); + } + private static byte[] decodeGroupId(String groupId) { try { return Base64.decode(groupId);