Changeset 6f5da22 in rtems-central


Ignore:
Timestamp:
01/22/21 05:53:54 (16 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
4d5c6b9
Parents:
6ef15af
Message:

items: Improve identifier to value error message

Location:
rtemsspec
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemsspec/items.py

    r6ef15af r6f5da22  
    516516                raise ValueError(msg) from err
    517517        key_path = normalize_key_path(key_path, prefix)
    518         value = item.get_by_normalized_key_path(key_path,
    519                                                 self.get_value_map(item))
     518        try:
     519            value = item.get_by_normalized_key_path(key_path,
     520                                                    self.get_value_map(item))
     521        except Exception as err:
     522            msg = (f"cannot get value for '{key_path}' of {item.spec} "
     523                   f"specified by '{identifier}'")
     524            raise ValueError(msg) from err
    520525        for func in pipes:
    521526            value = getattr(self, func)(value)
  • rtemsspec/tests/test_items_itemcache.py

    r6ef15af r6f5da22  
    165165    with pytest.raises(ValueError, match=match):
    166166        mapper.map("boom:bam", item, "blub")
     167    match = r"cannot get value for 'blub/bam' of spec:/p specified by '.:bam'"
     168    with pytest.raises(ValueError, match=match):
     169        mapper.map(".:bam", item, "blub")
    167170
    168171
Note: See TracChangeset for help on using the changeset viewer.