From b37fb3673577af86b00b40b90b3c1a6117dec529 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 23 May 2021 00:16:48 +0300 Subject: fix handle_exc --- inverter-bot | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inverter-bot b/inverter-bot index 6f8c40b..fc6fccc 100755 --- a/inverter-bot +++ b/inverter-bot @@ -84,7 +84,10 @@ def handle_exc(update: Update, e) -> None: logging.exception(str(e)) if isinstance(e, InverterError): - err = json.loads(str(e))['message'] + try: + err = json.loads(str(e))['message'] + except json.decoder.JSONDecodeError: + err = str(e) reply(update, f'Error: {err}') elif not isinstance(e, TimedOut): -- cgit v1.2.3