[Console] Fix unhandled error in torrentactions
Fix calls to core pause and resume using the singular methods with a list of torrent ids. Fix and simplify the handling of errors from core.
This commit is contained in:
parent
c655da38c8
commit
c7567ddee4
@ -33,12 +33,7 @@ torrent_options = [
|
|||||||
|
|
||||||
|
|
||||||
def action_error(error, mode):
|
def action_error(error, mode):
|
||||||
rerr = error.value
|
mode.report_message('Error Occurred', error.getErrorMessage())
|
||||||
mode.report_message(
|
|
||||||
'An Error Occurred', '%s got error %s: %s' % (
|
|
||||||
rerr.method, rerr.exception_type, rerr.exception_msg,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
mode.refresh()
|
mode.refresh()
|
||||||
|
|
||||||
|
|
||||||
@ -172,11 +167,11 @@ def torrent_action(action, *args, **kwargs):
|
|||||||
|
|
||||||
if action == ACTION.PAUSE:
|
if action == ACTION.PAUSE:
|
||||||
log.debug('Pausing torrents: %s', torrent_ids)
|
log.debug('Pausing torrents: %s', torrent_ids)
|
||||||
client.core.pause_torrent(torrent_ids).addErrback(action_error, mode)
|
client.core.pause_torrents(torrent_ids).addErrback(action_error, mode)
|
||||||
retval = True
|
retval = True
|
||||||
elif action == ACTION.RESUME:
|
elif action == ACTION.RESUME:
|
||||||
log.debug('Resuming torrents: %s', torrent_ids)
|
log.debug('Resuming torrents: %s', torrent_ids)
|
||||||
client.core.resume_torrent(torrent_ids).addErrback(action_error, mode)
|
client.core.resume_torrents(torrent_ids).addErrback(action_error, mode)
|
||||||
retval = True
|
retval = True
|
||||||
elif action == ACTION.QUEUE:
|
elif action == ACTION.QUEUE:
|
||||||
queue_mode = QueueMode(mode, torrent_ids)
|
queue_mode = QueueMode(mode, torrent_ids)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user