1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Fix JSONDecodeError

Fix #814
This commit is contained in:
Julien Duponchelle 2016-12-12 10:03:40 +01:00
parent 508edf5cc5
commit 4bb990bf0c
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ class Controller:
self.save() self.save()
with open(self._config_file) as f: with open(self._config_file) as f:
data = json.load(f) data = json.load(f)
except (OSError, json.JSONDecodeError) as e: except (OSError, json.decoder.JSONDecodeError) as e:
log.critical("Cannot load %s: %s", self._config_file, str(e)) log.critical("Cannot load %s: %s", self._config_file, str(e))
return return

View File

@ -112,7 +112,7 @@ def load_topology(path):
try: try:
with open(path, encoding="utf-8") as f: with open(path, encoding="utf-8") as f:
topo = json.load(f) topo = json.load(f)
except (OSError, UnicodeDecodeError, json.JSONDecodeError) as e: except (OSError, UnicodeDecodeError, json.decoder.JSONDecodeError) as e:
raise aiohttp.web.HTTPConflict(text="Could not load topology {}: {}".format(path, str(e))) raise aiohttp.web.HTTPConflict(text="Could not load topology {}: {}".format(path, str(e)))
if "revision" not in topo or topo["revision"] < 5: if "revision" not in topo or topo["revision"] < 5:
# If it's an old GNS3 file we need to convert it # If it's an old GNS3 file we need to convert it