mirror of
https://github.com/openSUSE/snapper.git
synced 2026-02-05 15:46:00 +01:00
- work on dbus interface
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user