mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-07 17:26:32 +00:00
Print error on invalid json (#263)
This commit is contained in:
parent
747810b729
commit
8f94b4d63f
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user