mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
[Core] Catch keyerror in add torrent alert
This commit is contained in:
parent
d8e5cbe689
commit
e2e13103b8
1 changed files with 7 additions and 2 deletions
|
@ -392,8 +392,8 @@ class TorrentManager(component.Component):
|
||||||
add_torrent_params['flags'] |= lt.add_torrent_params_flags_t.flag_seed_mode
|
add_torrent_params['flags'] |= lt.add_torrent_params_flags_t.flag_seed_mode
|
||||||
|
|
||||||
d = Deferred()
|
d = Deferred()
|
||||||
|
self.torrents_loading[torrent_id] = (d, options, state, filename, magnet, resume_data, filedump, save_state)
|
||||||
try:
|
try:
|
||||||
self.torrents_loading[torrent_id] = (d, options, state, filename, magnet, resume_data, filedump, save_state)
|
|
||||||
self.session.async_add_torrent(add_torrent_params)
|
self.session.async_add_torrent(add_torrent_params)
|
||||||
except RuntimeError as ex:
|
except RuntimeError as ex:
|
||||||
raise AddTorrentError('Unable to add torrent to session: %s' % ex)
|
raise AddTorrentError('Unable to add torrent to session: %s' % ex)
|
||||||
|
@ -892,7 +892,12 @@ class TorrentManager(component.Component):
|
||||||
log.warn('Failed to get torrent id from handle: %s', ex)
|
log.warn('Failed to get torrent id from handle: %s', ex)
|
||||||
return
|
return
|
||||||
|
|
||||||
d, options, state, filename, magnet, resume_data, filedump, save_state = self.torrents_loading.pop(torrent_id)
|
try:
|
||||||
|
(d, options, state, filename, magnet, resume_data, filedump,
|
||||||
|
save_state) = self.torrents_loading.pop(torrent_id)
|
||||||
|
except KeyError as ex:
|
||||||
|
log.warn('Torrent id not in torrents loading list: %s', ex)
|
||||||
|
return
|
||||||
|
|
||||||
# Create a Torrent object and add to the dictionary.
|
# Create a Torrent object and add to the dictionary.
|
||||||
torrent = Torrent(alert.handle, options, state, filename, magnet)
|
torrent = Torrent(alert.handle, options, state, filename, magnet)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue