diff options
-rwxr-xr-x | inverter-bot | 5 |
1 files changed, 4 insertions, 1 deletions
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'<b>Error:</b> {err}') elif not isinstance(e, TimedOut): |