- private void initDbusClient(
- final Command command, final String account, final boolean systemBus, final CommandHandler commandHandler
- ) throws CommandException {
- try {
- final var busType = systemBus ? DBusConnection.DBusBusType.SYSTEM : DBusConnection.DBusBusType.SESSION;
- try (var dBusConn = DBusConnectionBuilder.forType(busType).build()) {
- DbusCommandHandler.handleCommand(command, account, dBusConn, commandHandler);
- }
- } catch (ServiceUnknown e) {
- throw new UserErrorException("signal-cli DBus daemon not running on "
- + (systemBus ? "system" : "session")
- + " bus: "
- + e.getMessage(), e);
- } catch (DBusExecutionException | DBusException | IOException e) {
- throw new UnexpectedErrorException("Dbus client failed: " + e.getMessage(), e);
- }
- }
-