- private int handleCommand(Command command, Signal ts, DBusConnection dBusConn) {
- if (command instanceof ExtendedDbusCommand) {
- return ((ExtendedDbusCommand) command).handleCommand(ns, ts, dBusConn);
- } else if (command instanceof DbusCommand) {
- return ((DbusCommand) command).handleCommand(ns, ts);
+ private void handleCommand(
+ Command command, Signal ts, DBusConnection dBusConn, OutputWriter outputWriter
+ ) throws CommandException {
+ if (command instanceof LocalCommand localCommand) {
+ try (final var m = new DbusManagerImpl(ts, dBusConn)) {
+ localCommand.handleCommand(ns, m, outputWriter);
+ } catch (UnsupportedOperationException e) {
+ throw new UserErrorException("Command is not yet implemented via dbus", e);
+ } catch (IOException | DBusExecutionException e) {
+ throw new UnexpectedErrorException(e.getMessage(), e);
+ }