summaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-06-28 01:03:02 +0200
committerSebastian Reichel <sre@ring0.de>2018-06-28 01:53:40 +0200
commitf466538a3527cd539c732d3abee481fa7a34fc2f (patch)
tree0a244c5b3594ee42d25744bdbdd3f0a44595c87b /src/cli
parentc70d626e473c8cbdbd87125a256ca221c0c3fa23 (diff)
downloadserial-barcode-scanner-f466538a3527cd539c732d3abee481fa7a34fc2f.tar.bz2
all: Add DBusError to avoid warnings with valac 0.40
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/cli.vala2
-rw-r--r--src/cli/main.vala8
2 files changed, 7 insertions, 3 deletions
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
+}