From f466538a3527cd539c732d3abee481fa7a34fc2f Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Thu, 28 Jun 2018 01:03:02 +0200 Subject: all: Add DBusError to avoid warnings with valac 0.40 --- src/cli/cli.vala | 2 +- src/cli/main.vala | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/cli') diff --git a/src/cli/cli.vala b/src/cli/cli.vala index bc6fe9d..c0ba61e 100644 --- a/src/cli/cli.vala +++ b/src/cli/cli.vala @@ -21,7 +21,7 @@ public class CliImpl { public CliImpl() { } - public void send(string msg) { + public void send(string msg) throws IOError, DBusError { stdout.printf("Sending: %s\n", msg); received_barcode(msg); } diff --git a/src/cli/main.vala b/src/cli/main.vala index a3208dd..377efa1 100644 --- a/src/cli/main.vala +++ b/src/cli/main.vala @@ -42,7 +42,11 @@ public static int main(string[] args) { void on_name_aquired() { foreach (string cmd in commands) { - cli.send(cmd); + try { + cli.send(cmd); + } catch (Error e) { + stderr.printf("Error sending command: %s", e.message); + } } // wait a minimal amount of time, to ensure the event was sent @@ -62,4 +66,4 @@ void on_bus_aquired(DBusConnection con) { stderr.printf("Could not register service\n"); } -} \ No newline at end of file +} -- cgit v1.2.3