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

Handle more topologie loading errrors

Fix #671
This commit is contained in:
Julien Duponchelle 2016-09-08 10:54:54 +02:00
parent de526482e3
commit 0910712657
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -91,7 +91,7 @@ def load_topology(path):
try: try:
with open(path) as f: with open(path) as f:
topo = json.load(f) topo = json.load(f)
except OSError as e: except (OSError, UnicodeEncodeError, json.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"] < GNS3_FILE_FORMAT_REVISION: if "revision" not in topo or topo["revision"] < GNS3_FILE_FORMAT_REVISION:
# If it's an old GNS3 file we need to convert it # If it's an old GNS3 file we need to convert it