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.
This commit is contained in:
laanwj
2022-04-12 20:18:03 +02:00
committed by Michael Schmoock
parent 1b73ad8877
commit 1b8d5dde57

View File

@@ -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