Skip to content

Commit fa02838

Browse files
committed
Improve handling of missing or broken mapping cores
1 parent 4f2324f commit fa02838

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

fusesoc/coremanager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def mapping_set(self, mapping_vlnvs: Iterable[str]) -> None:
178178
new_mapping_name = str(Vlnv(mapping_vlnv))
179179
new_mapping_core = self._cores.get(new_mapping_name)
180180
if not new_mapping_core:
181-
raise RuntimeError(f"The core '{mapping_vlnv}' wasn't found.")
181+
raise RuntimeError(
182+
f"Requested mapping core '{mapping_vlnv}' wasn't found."
183+
)
182184

183185
new_mapping_raw = new_mapping_core["core"].mapping
184186
if not new_mapping_raw:

fusesoc/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ def run(fs, args):
327327
else:
328328
flags[flag] = True
329329

330-
fs.cm.db.mapping_set(args.mapping)
330+
try:
331+
fs.cm.db.mapping_set(args.mapping)
332+
except RuntimeError as e:
333+
logger.error(e)
334+
exit(1)
331335

332336
if args.lockfile is not None:
333337
try:

0 commit comments

Comments
 (0)