better error message for non-existent data values accessors
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
currently when data values are not provided you may encounter error like this `NoneType has no .namespace field or method`:
```
ytt: Error:
- library.eval: Evaluating library 'namespace':
in
00-common.yaml:9 | --- #@ template.replace(contour_namespace.eval())
reason:
- NoneType has no .namespace field or method
in
_ytt_lib/namespace/ns.yaml:7 | name: #@ data.values.namespace
```
it would be nice if data values struct had additional error messaging when accessing keys that do not exist. in future we could even augment it with schema based info.
(ideally we could also improve generic accessor error messages cases where something is None, e.g. blah.foo.bar and blah happens to be None)
Contributor guide
Research direction
Start with the failing access shown in _ytt_lib/namespace/ns.yaml and trace how missing data.values keys and None values are evaluated. Define clearer errors for missing data values, while treating the broader blah.foo.bar case as a possible extension; done means the example reports which value is missing instead of a NoneType accessor error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100