diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-08-16 11:37:31 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-19 12:52:26 -0700 |
commit | dee41bb04906d6976b4f7c05c222f7d95182b3ea (patch) | |
tree | 2dbe16e47e3b8fee167d9375e83bd42585e78464 /alot/commands | |
parent | 188d79a0189b480656542a09be348fcbf506f33d (diff) |
Replace Exception.message with str(Exception)
In python3 Exception doesn't have a message attribute, the only way to
get the string output is to call str() on the Exception. This also works
in python 2.7, so go ahead and make that change.
Diffstat (limited to 'alot/commands')
-rw-r--r-- | alot/commands/__init__.py | 2 | ||||
-rw-r--r-- | alot/commands/envelope.py | 10 | ||||
-rw-r--r-- | alot/commands/thread.py | 6 | ||||
-rw-r--r-- | alot/commands/utils.py | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index 351fc993..0638926a 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -167,7 +167,7 @@ def commandfactory(cmdline, mode='global'): try: args = split_commandstring(cmdline) except ValueError as e: - raise CommandParseError(e.message) + raise CommandParseError(str(e)) args = [string_decode(x, 'utf-8') for x in args] logging.debug('ARGS: %s', args) cmdname = args[0] diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index b9ff51d6..4d2963ee 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -146,8 +146,8 @@ class SaveCommand(Command): ui.apply_command(globals.FlushCommand()) ui.apply_command(commands.globals.BufferCloseCommand()) except DatabaseError as e: - logging.error(e.message) - ui.notify('could not index message:\n%s' % e.message, + logging.error(e) + ui.notify('could not index message:\n%s' % e, priority='error', block=True) else: @@ -217,7 +217,7 @@ class SendCommand(Command): self.mail = email_as_string(self.mail) except GPGProblem as e: ui.clear_notify([clearme]) - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') return ui.clear_notify([clearme]) @@ -499,7 +499,7 @@ class SignCommand(Command): sign=True) except GPGProblem as e: envelope.sign = False - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') return else: try: @@ -571,7 +571,7 @@ class EncryptCommand(Command): tmp_key = crypto.get_key(keyid) del envelope.encrypt_keys[tmp_key.fpr] except GPGProblem as e: - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') if not envelope.encrypt_keys: envelope.encrypt = False ui.current_buffer.rebuild() diff --git a/alot/commands/thread.py b/alot/commands/thread.py index acbb4e28..d73ef622 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -186,7 +186,7 @@ class ReplyCommand(Command): try: from_header, _ = determine_sender(mail, 'reply') except AssertionError as e: - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') return envelope.add('From', from_header) @@ -394,7 +394,7 @@ class ForwardCommand(Command): try: from_header, _ = determine_sender(mail, 'reply') except AssertionError as e: - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') return envelope.add('From', from_header) @@ -441,7 +441,7 @@ class BounceMailCommand(Command): try: resent_from_header, account = determine_sender(mail, 'bounce') except AssertionError as e: - ui.notify(e.message, priority='error') + ui.notify(str(e), priority='error') return mail['Resent-From'] = resent_from_header diff --git a/alot/commands/utils.py b/alot/commands/utils.py index 0aa80656..1bf64cbb 100644 --- a/alot/commands/utils.py +++ b/alot/commands/utils.py @@ -86,7 +86,7 @@ def _get_keys(ui, encrypt_keyids, block_error=False, signed_only=False): encrypt_keyids.append(keyid) continue else: - ui.notify(e.message, priority='error', block=block_error) + ui.notify(str(e), priority='error', block=block_error) continue keys[key.fpr] = key returnValue(keys) |