- if (command instanceof ExtendedDbusCommand) {
- ((ExtendedDbusCommand) command).handleCommand(ns, ts, dBusConn, outputWriter);
- } else if (command instanceof DbusCommand) {
- ((DbusCommand) command).handleCommand(ns, ts, outputWriter);
+ if (command instanceof LocalCommand localCommand) {
+ try {
+ localCommand.handleCommand(ns, new DbusManagerImpl(ts, dBusConn), outputWriter);
+ } catch (UnsupportedOperationException e) {
+ throw new UserErrorException("Command is not yet implemented via dbus", e);
+ } catch (DBusExecutionException e) {
+ throw new UnexpectedErrorException(e.getMessage(), e);
+ }