From 4f5e037d39742c8916b15ce6c5363456db1708a9 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 3 Mar 2016 12:22:25 -0800 Subject: [PATCH] cmd-twisted: report exceptions better The previous scheme would swallow the real traceback, making debugging difficult. --- src/wormhole/scripts/cmd_receive_twisted.py | 5 +++-- src/wormhole/scripts/cmd_send_twisted.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wormhole/scripts/cmd_receive_twisted.py b/src/wormhole/scripts/cmd_receive_twisted.py index b8b97ba..ca35f6e 100644 --- a/src/wormhole/scripts/cmd_receive_twisted.py +++ b/src/wormhole/scripts/cmd_receive_twisted.py @@ -22,13 +22,14 @@ def receive_twisted_sync(args): rc.extend([True, res]) reactor.stop() def _err(f): - rc.extend([False, f.value]) + rc.extend([False, f]) reactor.stop() d.addCallbacks(_done, _err) reactor.run() if rc[0]: return rc[1] - raise rc[1] + print(str(rc[1])) + rc[1].raiseException() def receive_twisted(args): return TwistedReceiver(args).go() diff --git a/src/wormhole/scripts/cmd_send_twisted.py b/src/wormhole/scripts/cmd_send_twisted.py index 75ceb09..3a45446 100644 --- a/src/wormhole/scripts/cmd_send_twisted.py +++ b/src/wormhole/scripts/cmd_send_twisted.py @@ -24,13 +24,14 @@ def send_twisted_sync(args): rc.extend([True, res]) reactor.stop() def _err(f): - rc.extend([False, f.value]) + rc.extend([False, f]) reactor.stop() d.addCallbacks(_done, _err) reactor.run() if rc[0]: return rc[1] - raise rc[1] + print(str(rc[1])) + rc[1].raiseException() @inlineCallbacks def send_twisted(args):