Mercurial > libervia-pubsub
diff idavoll/backend.py @ 196:00a6dbfbee42
Return deferreds on failure, instead of raising exceptions.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 10 Jun 2008 08:28:57 +0000 |
parents | c21b986cff30 |
children | e404775b12df |
line wrap: on
line diff
--- a/idavoll/backend.py Thu Jun 18 11:54:52 2009 +0000 +++ b/idavoll/backend.py Tue Jun 10 08:28:57 2008 +0000 @@ -248,7 +248,7 @@ def get_node_configuration(self, node_id): if not node_id: - raise error.NoRootNode() + return defer.fail(error.NoRootNode()) d = self.storage.get_node(node_id) d.addCallback(lambda node: node.get_configuration()) @@ -269,16 +269,16 @@ def set_node_configuration(self, node_id, options, requestor): if not node_id: - raise error.NoRootNode() + return defer.fail(error.NoRootNode()) for key, value in options.iteritems(): if not self.options.has_key(key): - raise error.InvalidConfigurationOption() + return defer.fail(error.InvalidConfigurationOption()) if self.options[key]["type"] == 'boolean': try: options[key] = bool(int(value)) except ValueError: - raise error.InvalidConfigurationValue() + return defer.fail(error.InvalidConfigurationValue()) d = self.storage.get_node(node_id) d.addCallback(_get_affiliation, requestor)