From 7698ab7053462d9f49242d782eaf411f19f6b8c0 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 27 Aug 2018 11:47:32 -0400 Subject: [PATCH] catch InvalidOperation exception when parsing decimals --- lbrynet/daemon/Daemon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 2df9e8166..d5667ecd7 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -3294,7 +3294,10 @@ class Daemon(AuthJSONRPCServer): def get_dewies_or_error(argument: str, amount: Union[str, int, float]): if isinstance(amount, str): if '.' in amount: - return int(Decimal(amount) * COIN) + try: + return int(Decimal(amount) * COIN) + except InvalidOperation: + raise ValueError("Invalid decimal for '{}' argument: {}".format(argument, amount)) elif amount.isdigit(): amount = int(amount) if isinstance(amount, (float, int)):