When interactions fail return the interaction exception

This was returning the base task exception, but that is often a timeout
because of the interaction failure, so show the interaction failure
instead.
This commit is contained in:
Jason Rhinelander 2023-04-28 17:46:49 -03:00
parent fb115165ae
commit f071812d12
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 6 additions and 4 deletions

View File

@ -161,10 +161,12 @@ def run_with_interactions(ledger, main, *interactions, timeout=30, poll=0.25):
int_fail = e
if int_fail is not None:
# Wait for a result, but discard it. If the future raises an exception we throw that
# because it is probably more relevant:
future.result()
# Otherwise we throw our timeout/eof exception
# Wait for a result, but discard it (and ignore an exception, if it throws one, because we
# have an interactions exception that is probably more relevant):
try:
future.result()
except Exception:
pass
raise int_fail
return future.result()