From 8f94b4d63f5f474ee07b6d1608a48c9f9a6d94f0 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 30 Nov 2017 20:23:20 +0100 Subject: [PATCH] Print error on invalid json (#263) --- hassio/api/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hassio/api/util.py b/hassio/api/util.py index b04451a1c..78c2efd4c 100644 --- a/hassio/api/util.py +++ b/hassio/api/util.py @@ -17,10 +17,12 @@ _LOGGER = logging.getLogger(__name__) def json_loads(data): """Extract json from string with support for '' and None.""" + if not data: + return {} try: return json.loads(data) except json.JSONDecodeError: - return {} + raise RuntimeError("Invalid json") def api_process(method):