mirror of https://github.com/ARMmbed/mbed-os.git
tools: Raise NotSupported when target definition is incomplete
### Description Noticed by the online compiler: When a user has an incomplete target definition, the error is not show to the user. That's because it's reported as a `KeyError`. This PR adds an outer `NotSupportedException` so that the outer catch statement knows that this is not a build system crash, but a user error. ### Pull request type [x] Fix [ ] Refactor [ ] Target update [ ] Functionality change [ ] Breaking changepull/8288/head
parent
8054060bf2
commit
9c3307ab20
|
@ -25,10 +25,11 @@ import sys
|
|||
from copy import copy
|
||||
from inspect import getmro
|
||||
from collections import namedtuple, Mapping
|
||||
from future.utils import raise_from
|
||||
from tools.resources import FileType
|
||||
from tools.targets.LPC import patch
|
||||
from tools.paths import TOOLS_BOOTLOADERS
|
||||
from tools.utils import json_file_to_dict
|
||||
from tools.utils import json_file_to_dict, NotSupportedException
|
||||
|
||||
__all__ = ["target", "TARGETS", "TARGET_MAP", "TARGET_NAMES", "CORE_LABELS",
|
||||
"CORE_ARCH", "HookError", "generate_py_target", "Target",
|
||||
|
@ -116,7 +117,12 @@ def get_resolution_order(json_data, target_name, order, level=0):
|
|||
|
||||
def target(name, json_data):
|
||||
"""Construct a target object"""
|
||||
resolution_order = get_resolution_order(json_data, name, [])
|
||||
try:
|
||||
resolution_order = get_resolution_order(json_data, name, [])
|
||||
except KeyError as exc:
|
||||
raise_from(NotSupportedException(
|
||||
"target {} has an incomplete target definition".format(name)
|
||||
), exc)
|
||||
resolution_order_names = [tgt for tgt, _ in resolution_order]
|
||||
return Target(name=name,
|
||||
json_data={key: value for key, value in json_data.items()
|
||||
|
|
Loading…
Reference in New Issue