hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

Improve error output when diagnostic's subject is nil #48

Closed wata727 closed 5 years ago

wata727 commented 5 years ago

When using Terraform as a library, I noticed that when the Subject of hcl.diagnotic is nil, it returns unnatural error output like the following:

<nil>: Failed to read file; The file "example1.tfvars" could not be read.

Errors that failed to read the file naturally have no hcl.Range. In such a case, I think that it should not include the Subject in error message. What do you think?

wata727 commented 5 years ago

Sorry, I will close this PR because it is no longer necessary for me. Feel free to reopen if anyone needs.