From fc0affc16dee44513f1f628a92f7ed8046bb5aea Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Tue, 5 Jun 2012 17:00:56 +0200 Subject: [PATCH] - work on dbus interface --- client/snapper.cc | 8 +++++--- dbus/DBusMessage.h | 2 +- server/snapperd.cc | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/client/snapper.cc b/client/snapper.cc index b5a324ef..4191c6db 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -1221,13 +1221,15 @@ main(int argc, char** argv) catch (const DBus::ErrorException& e) { if (strcmp(e.name(), "error.no_permissions") == 0) - cerr << "failed (no permissions)" << endl; + cerr << _("No permissions.") << endl; + else if (strcmp(e.name(), "error.invalid_userdata") == 0) + cerr << _("Invalid userdata.") << endl; else - cerr << "failed (" << e.what() << ")" << endl; + cerr << _("Failure") << " (" << e.what() << ")." << endl; } catch (const DBus::FatalException& e) { - cerr << "failed (" << e.what() << ")" << endl; + cerr << _("Failure") << " (" << e.what() << ")." << endl; } exit(EXIT_SUCCESS); diff --git a/dbus/DBusMessage.h b/dbus/DBusMessage.h index b8f3ea48..0d865218 100644 --- a/dbus/DBusMessage.h +++ b/dbus/DBusMessage.h @@ -50,7 +50,7 @@ namespace DBus struct ErrorException : public Exception { explicit ErrorException(const DBusError err) throw() : err(err) {} - ~ErrorException() throw() { dbus_error_free(&err); } + virtual ~ErrorException() throw() { dbus_error_free(&err); } virtual const char* what() const throw() { return "dbus error exception"; } virtual const char* name() const throw() { return err.name; } virtual const char* message() const throw() { return err.message; } diff --git a/server/snapperd.cc b/server/snapperd.cc index 6c8780f2..52f6665c 100644 --- a/server/snapperd.cc +++ b/server/snapperd.cc @@ -1068,6 +1068,11 @@ dispatch(DBus::Connection& conn, DBus::Message& msg) DBus::MessageError reply(msg, "error.illegal_snapshot", DBUS_ERROR_FAILED); conn.send(reply); } + catch (const InvalidUserdataException& e) + { + DBus::MessageError reply(msg, "error.invalid_userdata", DBUS_ERROR_FAILED); + conn.send(reply); + } catch (...) { DBus::MessageError reply(msg, "error.something", DBUS_ERROR_FAILED);