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 message for relative interpolations #1126

Open
MatteoVoges opened this issue Sep 22, 2023 · 1 comment
Open

Improve error message for relative interpolations #1126

MatteoVoges opened this issue Sep 22, 2023 · 1 comment

Comments

@MatteoVoges
Copy link
Contributor

MatteoVoges commented Sep 22, 2023

Is your feature request related to a problem? Please describe.

Current error message

from omegaconf import OmegaConf

input = """
a:
  a: 
    a: ${..b}
"""

config = OmegaConf.create(input)
try:
    OmegaConf.resolve(config)
except Exception as e:
    print(e)
# >>> Interpolation key 'b' not found

We see that the dots / the relative path doesn't show up in the error message. This makes it really hard to debug not found keys.

Describe the solution you'd like

There are several ways to solve this problem and to improve the error message:

  1. show the full path of the key that couldn't found, e.g. : Interpolation key 'a.b' not found
  2. show the relative path of the key like in the interpolation: Interpolation key '..b' not found
  3. show the nodes path, where the interpolation is defined, e.g: Interpolation key 'a.b' not found at node a.a.a

I would prefer a mix of these options, but I like option 3 the most, because there its clear which key is missing and where to look to fix the interpolation.

@MatteoVoges MatteoVoges changed the title Improve error message for relative inteprolations Improve error message for relative interpolations Sep 22, 2023
@odelalleau
Copy link
Collaborator

I think the ideal message would display:

  • The original interpolation path (..b)
  • The resolved one (a.b)
  • The full path to the node that crashed (a.a.a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants