Skip to content

Commit

Permalink
More readable error message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
odelalleau committed Nov 29, 2020
1 parent e4382e5 commit a8ff6f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions omegaconf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ def _select_impl(
)

if ret is not None and not isinstance(ret, Container):
parent_key = ".".join(split[0 : i + 1])
child_key = split[i + 1]
raise ConfigKeyError(
f"Error trying to access {key}: node `{'.'.join(split[0:i + 1])}` "
f"is not a container and thus cannot contain `{split[i + 1]}``"
f"Error trying to access {key}: node `{parent_key}` "
f"is not a container and thus cannot contain `{child_key}`"
)
root = ret

Expand Down

0 comments on commit a8ff6f9

Please sign in to comment.