diff options
author | Ruben Pollan <meskio@sindominio.net> | 2014-12-29 00:27:27 -0600 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2015-01-15 13:10:57 -0600 |
commit | 9482f5426dca3c9f053b71501aa08514cfab6672 (patch) | |
tree | a14653ce226e4919afd5d0e9436760e94279e615 /src/leap/keymanager/__init__.py | |
parent | 2b0826c821a933aa2a24a4a318096dc79305d0b2 (diff) |
Return a valid error from gatherResults
Diffstat (limited to 'src/leap/keymanager/__init__.py')
-rw-r--r-- | src/leap/keymanager/__init__.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py index 5324d429..c4050fa8 100644 --- a/src/leap/keymanager/__init__.py +++ b/src/leap/keymanager/__init__.py @@ -485,8 +485,8 @@ class KeyManager(object): dpriv = defer.succeed(None) if sign is not None: dpriv = self.get_key(sign, ktype, private=True) - d = defer.gatherResults([dpub, dpriv]) - d.addCallback(encrypt) + d = defer.gatherResults([dpub, dpriv], consumeErrors=True) + d.addCallbacks(encrypt, self._extract_first_error) return d def decrypt(self, data, address, ktype, passphrase=None, verify=None, @@ -542,10 +542,13 @@ class KeyManager(object): dpub = self.get_key(verify, ktype, private=False, fetch_remote=fetch_remote) dpub.addErrback(lambda f: None if f.check(KeyNotFound) else f) - d = defer.gatherResults([dpub, dpriv]) - d.addCallback(decrypt) + d = defer.gatherResults([dpub, dpriv], consumeErrors=True) + d.addCallbacks(decrypt, self._extract_first_error) return d + def _extract_first_error(self, failure): + return failure.value.subFailure + def sign(self, data, address, ktype, digest_algo='SHA512', clearsign=False, detach=True, binary=False): """ |