From 1b8d5dde57f70d10877035fce5f3d7c253280c93 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Tue, 12 Apr 2022 20:18:03 +0200 Subject: [PATCH] rebalance: Re-raise all exceptions in cleanup() This solves an apparent logic error where errors that are not a subclass of RpcError would be reported as succesful rebalance. Change it so that they are re-raised too, so the caller can report them. Should fix #355. --- rebalance/rebalance.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rebalance/rebalance.py b/rebalance/rebalance.py index 614e263..e79ccf9 100755 --- a/rebalance/rebalance.py +++ b/rebalance/rebalance.py @@ -113,11 +113,12 @@ def cleanup(label, payload, rpc_result, error=None): if 'status is paid' in e.error.get('message', ""): return rpc_result - if error is not None and isinstance(error, RpcError): - # unwrap rebalance errors as 'normal' RPC result - if error.method == "rebalance": - return {"status": "exception", - "message": error.error.get('message', "error not given")} + if error is not None: + if isinstance(error, RpcError): + # unwrap rebalance errors as 'normal' RPC result + if error.method == "rebalance": + return {"status": "exception", + "message": error.error.get('message', "error not given")} raise error return rpc_result