Skip to content

Commit

Permalink
refactor: improve python error messages (#2415)
Browse files Browse the repository at this point in the history
Sometimes, the `setattr` in our special python constructor fails, and
its not so easy to find out why. This should help by printing the key
and the value that did not work together.
  • Loading branch information
benjaminhuth authored Sep 4, 2023
1 parent 2bc27b9 commit 6974f92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Examples/Python/python/acts/_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def wrapped(self, *args, **kwargs):
v = str(v)

if hasattr(cfg, k):
setattr(cfg, k, v)
try:
setattr(cfg, k, v)
except TypeError as e:
raise RuntimeError(
"{}: Failed to set {}={}".format(type(cfg), k, v)
) from e
else:
_kwargs[k] = v
try:
Expand Down

0 comments on commit 6974f92

Please sign in to comment.