diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-27 07:08:34 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-07-27 07:08:34 +0200 |
commit | 6a3a6648dcdff1bdef63bb3351b453a9e9d54d6c (patch) | |
tree | 687af6eb5879b6b6192529b616b5c1512868b467 /rtemsspec/items.py | |
parent | spec: Add top-level requirement for the system (diff) | |
download | rtems-central-6a3a6648dcdff1bdef63bb3351b453a9e9d54d6c.tar.bz2 |
items: Improve ItemCache exception message
Diffstat (limited to 'rtemsspec/items.py')
-rw-r--r-- | rtemsspec/items.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py index 06c13525..cdcf451d 100644 --- a/rtemsspec/items.py +++ b/rtemsspec/items.py @@ -234,8 +234,13 @@ class Item: def init_parents(self, item_cache: "ItemCache"): """ Initializes the list of links to parents of this items. """ for data in self._data["links"]: - link = Link(item_cache[self.to_abs_uid(data["uid"])], data) - self._links_to_parents.append(link) + try: + link = Link(item_cache[self.to_abs_uid(data["uid"])], data) + self._links_to_parents.append(link) + except KeyError as err: + msg = (f"item '{self.uid}' links " + f"to non-existing item '{data['uid']}'") + raise KeyError(msg) from err def add_link_to_child(self, link: Link): """ Adds a link to a child item of this items. """ |