Show error message when broken JSON manifest is found

This commit is contained in:
Ivan Kravets
2016-08-24 23:03:41 +03:00
parent 0751c966c4
commit aa19b1c424
2 changed files with 9 additions and 1 deletions

View File

@ -60,6 +60,11 @@ class UnknownBoard(PlatformioException):
MESSAGE = "Unknown board ID '{0}'"
class InvalidBoardManifest(PlatformioException):
MESSAGE = "Invalid board JSON manifest '{0}'"
class UnknownFramework(PlatformioException):
MESSAGE = "Unknown framework '{0}'"

View File

@ -491,7 +491,10 @@ class PlatformBoardConfig(object):
self._id = basename(manifest_path)[:-5]
assert isfile(manifest_path)
self.manifest_path = manifest_path
self._manifest = util.load_json(manifest_path)
try:
self._manifest = util.load_json(manifest_path)
except ValueError:
raise exception.InvalidBoardManifest(manifest_path)
assert set(["name", "url", "vendor"]) <= set(self._manifest.keys())
def get(self, path, default=None):