diff options
author | mathieui <mathieui@mathieui.net> | 2017-10-12 01:23:40 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2017-10-12 01:23:40 +0200 |
commit | 3317604c6544a488bec749c06a52382971b60790 (patch) | |
tree | c7a8ff4b7019c6b1ab2a69f657dc4c5867ffd29c | |
parent | b29b70da0ff89fc24b2118c047f2071edcd36384 (diff) | |
download | poezio-3317604c6544a488bec749c06a52382971b60790.tar.gz poezio-3317604c6544a488bec749c06a52382971b60790.tar.bz2 poezio-3317604c6544a488bec749c06a52382971b60790.tar.xz poezio-3317604c6544a488bec749c06a52382971b60790.zip |
Fix some excepts (bare, useless, unused)
-rw-r--r-- | plugins/reminder.py | 2 | ||||
-rw-r--r-- | poezio/core/commands.py | 4 | ||||
-rw-r--r-- | poezio/core/completions.py | 2 | ||||
-rw-r--r-- | poezio/plugin_manager.py | 5 | ||||
-rw-r--r-- | poezio/tabs/conversationtab.py | 3 | ||||
-rwxr-xr-x | poezio/theming.py | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/plugins/reminder.py b/plugins/reminder.py index b26ca4a0..e3ba64cb 100644 --- a/plugins/reminder.py +++ b/plugins/reminder.py @@ -116,7 +116,7 @@ class Plugin(BasePlugin): def command_done(self, arg="0"): try: id_ = int(arg) - except: + except ValueError: return if id_ not in self.tasks: return diff --git a/poezio/core/commands.py b/poezio/core/commands.py index c256ccab..b08a082f 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -9,6 +9,8 @@ log = logging.getLogger(__name__) import os from xml.etree import cElementTree as ET +from slixmpp.exceptions import XMPPError +from slixmpp.xmlstream.xmlstream import NotConnectedError from slixmpp.xmlstream.stanzabase import StanzaBase from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.matcher import StanzaPath @@ -157,7 +159,7 @@ class CommandCore: pres = self.core.xmpp.make_presence(pto=jid, ptype=ptype, pstatus=status) self.core.events.trigger('send_normal_presence', pres) pres.send() - except: + except (XMPPError, NotConnectedError): self.core.information('Could not send directed presence', 'Error') log.debug('Could not send directed presence to %s', jid, exc_info=True) return diff --git a/poezio/core/completions.py b/poezio/core/completions.py index a6007152..634ab6b3 100644 --- a/poezio/core/completions.py +++ b/poezio/core/completions.py @@ -55,7 +55,7 @@ class CompletionCore: themes_dir = os.path.expanduser(themes_dir) try: names = os.listdir(themes_dir) - except OSError as e: + except OSError: log.error('Completion for /theme failed', exc_info=True) return False theme_files = [name[:-3] for name in names if name.endswith('.py') and name != '__init__.py'] diff --git a/poezio/plugin_manager.py b/poezio/plugin_manager.py index fe4bce20..9e2a8084 100644 --- a/poezio/plugin_manager.py +++ b/poezio/plugin_manager.py @@ -52,10 +52,7 @@ class PluginManager(object): def disable_plugins(self): for plugin in set(self.plugins.keys()): - try: - self.unload(plugin, notify=False) - except: - pass + self.unload(plugin, notify=False) def load(self, name, notify=True): """ diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index ecaac023..cc6d716d 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -26,6 +26,7 @@ from poezio.common import safeJID from poezio.config import config from poezio.decorators import refresh_wrapper from poezio.roster import roster +from poezio.text_buffer import CorrectionError from poezio.theming import get_theme, dump_tuple from poezio.decorators import command_args_parser @@ -116,7 +117,7 @@ class ConversationTab(OneToOneTab): self.modify_message(msg['body'], self.last_sent_message['id'], msg['id'], jid=self.core.xmpp.boundjid, nickname=self.core.own_nick) replaced = True - except: + except CorrectionError: log.error('Unable to correct a message', exc_info=True) else: del msg['replace'] diff --git a/poezio/theming.py b/poezio/theming.py index c740b86e..8641ba94 100755 --- a/poezio/theming.py +++ b/poezio/theming.py @@ -487,7 +487,7 @@ def update_themes_dir(option=None, value=None): # system-wide import try: import poezio_themes - except: + except ImportError: pass else: if poezio_themes.__path__: |