Skip to content

Commit 096db41

Browse files
committed
Make plugin collision error more clear. #39
1 parent 84fbd93 commit 096db41

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

peakrdl-cli/src/peakrdl/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import shlex
55
import re
6+
import inspect
67
from typing import TYPE_CHECKING, List, Dict, Optional, Set, Match
78

89
from systemrdl import RDLCompileError
@@ -132,7 +133,10 @@ def main() -> None:
132133
sc_dict = {} # type: Dict[str, Subcommand]
133134
for sc in subcommands:
134135
if sc.name in sc_dict:
135-
raise RuntimeError(f"More than one exporter plugin was registered with the same name '{sc.name}': \n\t{sc_dict[sc.name]}\n\t{sc}")
136+
other_sc = sc_dict[sc.name]
137+
sc_loc = f"{inspect.getfile(sc.__class__)}:{sc.__class__.__name__}"
138+
other_sc_loc = f"{inspect.getfile(other_sc.__class__)}:{other_sc.__class__.__name__}"
139+
raise RuntimeError(f"More than one exporter plugin was registered with the same name '{sc.name}': \n\t{other_sc_loc}\n\t{sc_loc}")
136140
sc_dict[sc.name] = sc
137141

138142
# Initialize top-level arg parser

0 commit comments

Comments
 (0)