[Lint] Standardise except code

* Using 'ex' variable name for exceptions.
This commit is contained in:
Calum Lind 2015-10-28 22:58:32 +00:00
parent 2583e9d888
commit 1ff189c63a
3 changed files with 7 additions and 11 deletions

View File

@ -363,8 +363,8 @@ class Core(component.Component):
for torrent_id in torrent_ids:
try:
self.torrentmanager.remove(torrent_id, remove_data=remove_data, save_state=False)
except InvalidTorrentError, ite:
errors.append((torrent_id, ite))
except InvalidTorrentError as ex:
errors.append((torrent_id, ex))
# Save the session state
self.torrentmanager.save_state()
return errors

View File

@ -28,11 +28,7 @@ class GtkUI(GtkPluginBase):
log.debug("Blocklist GtkUI enable..")
self.plugin = component.get("PluginManager")
try:
self.load_preferences_page()
except Exception as err:
log.exception(err)
raise
self.status_item = component.get("StatusBar").add_item(
image=common.get_resource("blocklist16.png"),
@ -200,10 +196,10 @@ class GtkUI(GtkPluginBase):
try:
ip = common.IP.parse(new_text)
model.set(model.get_iter_from_string(path_string), 0, ip.address)
except common.BadIP as e:
except common.BadIP as ex:
model.remove(model.get_iter_from_string(path_string))
from deluge.ui.gtkui import dialogs
d = dialogs.ErrorDialog(_("Bad IP address"), e.message)
d = dialogs.ErrorDialog(_("Bad IP address"), ex.message)
d.run()
def on_whitelist_treeview_selection_changed(self, selection):

View File

@ -70,8 +70,8 @@ def add_torrent(t_file, options, success_cb, fail_cb, ress):
try:
TorrentInfo(f)
except Exception as e:
fail_cb(e.message, f, ress)
except Exception as ex:
fail_cb(ex.message, f, ress)
continue
filename = os.path.split(f)[-1]