forked from Disroot/gpg-lacre
Fix unprintable exception issue
This commit is contained in:
parent
75c48282b0
commit
fe2c0cbf76
2 changed files with 10 additions and 21 deletions
|
@ -45,26 +45,15 @@ RX_CONFIRM = re.compile(br'key "([^"]+)" imported')
|
|||
|
||||
|
||||
class EncryptionException(Exception):
|
||||
"""Represents a failure to encrypt a payload."""
|
||||
"""Represents a failure to encrypt a payload.
|
||||
|
||||
def __str__(self):
|
||||
"""Return human-readable string representation."""
|
||||
recipient, issue, cause, key = self.args
|
||||
parts = []
|
||||
|
||||
if recipient:
|
||||
parts.append('To: ' + recipient)
|
||||
|
||||
if issue:
|
||||
parts.append('Issue: ' + issue)
|
||||
|
||||
if key:
|
||||
parts.append('Key: ' + key.decode())
|
||||
|
||||
if cause:
|
||||
parts.append('Cause: ' + cause)
|
||||
|
||||
return '; '.join(parts)
|
||||
Arguments passed to exception constructor:
|
||||
- issue: human-readable explanation of the issue;
|
||||
- recipient: owner of the key;
|
||||
- cause: any additional information, if present;
|
||||
- key: fingerprint of the key.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def _build_command(key_home, *args, **kwargs):
|
||||
|
|
|
@ -59,8 +59,8 @@ class MailEncryptionProxy:
|
|||
if not isinstance(operation, KeepIntact):
|
||||
self._send_unencrypted(operation, message, envelope, send)
|
||||
else:
|
||||
LOG.error('Cannot perform: %s', operation)
|
||||
raise e
|
||||
LOG.exception('Cannot perform: %s', operation)
|
||||
raise
|
||||
|
||||
except:
|
||||
LOG.exception('Unexpected exception caught, bouncing message')
|
||||
|
|
Loading…
Reference in a new issue