-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hcl: More helpful error messages in Index and GetAttr
When we first implemented these helpers we tried to anticipate a few situations that seemed likely to come up and implement specialized error messages for them, but in the intervening years we've seen a number of other situations crop up with some regularity. Given that, I've added a few more specialized error message cases to both of these functions, so we'll return the most generic error messages in fewer situations. Because hcl.Index and hcl.GetAttr are quite general functions used for lots of different application-specific purposes alongside their part in the implementation of the index and attribute access operators, I've intentionally kept these messages quite vague in the suggestions they make, which does mean that unfortunately users will probably need to do some further research to find a suitable resolution to these messages. Hopefully the extra context at least gives the user a better hook for that further research. Later we could consider putting some pre-checks in the actual operator implementations that would catch some of these prior to calling the generic functions and return a more directly-prescriptive error message which assumes we're in an expression evaluation context, but I'd like to see how these new messages are received in practice first, to see if that additional complexity would be warranted.
- Loading branch information
1 parent
a97795a
commit a4e3f26
Showing
2 changed files
with
286 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.