Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling for some kinds of chip.get / chip.getkeys failures. #1084

Merged
merged 4 commits into from
Jul 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions siliconcompiler/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,15 @@ def get(self, *keypath, field='value', job=None, cfg=None):

"""

# Ensure that all keypath values are strings.
# Scripts may accidentally pass in [None] if a prior schema entry was unexpectedly empty.
for kp in keypath:
if not type(kp) == str:
WRansohoff marked this conversation as resolved.
Show resolved Hide resolved
self.error(\
WRansohoff marked this conversation as resolved.
Show resolved Hide resolved
f'''An invalid keypath was passed to "chip.get":
{keypath}
Your Chip configuration may be missing a parameter which is expected by your build script.''')
WRansohoff marked this conversation as resolved.
Show resolved Hide resolved

if cfg is None:
if job is not None:
cfg = self.cfg['history'][job]
Expand Down Expand Up @@ -824,6 +833,15 @@ def getkeys(self, *keypath, cfg=None, job=None):
Returns all list of all keypaths in the schema.
"""

# Ensure that all keypath values are strings.
# Scripts may accidentally pass in [None] if a prior schema entry was unexpectedly empty.
for kp in keypath:
if not type(kp) == str:
self.error(\
f'''An invalid keypath was passed to "chip.getkeys":
{keypath}
Your Chip configuration may be missing a parameter which is expected by your build script.''')

if cfg is None:
if job is None:
cfg = self.cfg
Expand Down