[Lint] Standardise except code
* Using 'ex' variable name for exceptions.
This commit is contained in:
parent
2583e9d888
commit
1ff189c63a
|
@ -363,8 +363,8 @@ class Core(component.Component):
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
try:
|
try:
|
||||||
self.torrentmanager.remove(torrent_id, remove_data=remove_data, save_state=False)
|
self.torrentmanager.remove(torrent_id, remove_data=remove_data, save_state=False)
|
||||||
except InvalidTorrentError, ite:
|
except InvalidTorrentError as ex:
|
||||||
errors.append((torrent_id, ite))
|
errors.append((torrent_id, ex))
|
||||||
# Save the session state
|
# Save the session state
|
||||||
self.torrentmanager.save_state()
|
self.torrentmanager.save_state()
|
||||||
return errors
|
return errors
|
||||||
|
|
|
@ -28,11 +28,7 @@ class GtkUI(GtkPluginBase):
|
||||||
log.debug("Blocklist GtkUI enable..")
|
log.debug("Blocklist GtkUI enable..")
|
||||||
self.plugin = component.get("PluginManager")
|
self.plugin = component.get("PluginManager")
|
||||||
|
|
||||||
try:
|
|
||||||
self.load_preferences_page()
|
self.load_preferences_page()
|
||||||
except Exception as err:
|
|
||||||
log.exception(err)
|
|
||||||
raise
|
|
||||||
|
|
||||||
self.status_item = component.get("StatusBar").add_item(
|
self.status_item = component.get("StatusBar").add_item(
|
||||||
image=common.get_resource("blocklist16.png"),
|
image=common.get_resource("blocklist16.png"),
|
||||||
|
@ -200,10 +196,10 @@ class GtkUI(GtkPluginBase):
|
||||||
try:
|
try:
|
||||||
ip = common.IP.parse(new_text)
|
ip = common.IP.parse(new_text)
|
||||||
model.set(model.get_iter_from_string(path_string), 0, ip.address)
|
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))
|
model.remove(model.get_iter_from_string(path_string))
|
||||||
from deluge.ui.gtkui import dialogs
|
from deluge.ui.gtkui import dialogs
|
||||||
d = dialogs.ErrorDialog(_("Bad IP address"), e.message)
|
d = dialogs.ErrorDialog(_("Bad IP address"), ex.message)
|
||||||
d.run()
|
d.run()
|
||||||
|
|
||||||
def on_whitelist_treeview_selection_changed(self, selection):
|
def on_whitelist_treeview_selection_changed(self, selection):
|
||||||
|
|
|
@ -70,8 +70,8 @@ def add_torrent(t_file, options, success_cb, fail_cb, ress):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
TorrentInfo(f)
|
TorrentInfo(f)
|
||||||
except Exception as e:
|
except Exception as ex:
|
||||||
fail_cb(e.message, f, ress)
|
fail_cb(ex.message, f, ress)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
filename = os.path.split(f)[-1]
|
filename = os.path.split(f)[-1]
|
||||||
|
|
Loading…
Reference in New Issue