Hi @brandonchinn178!
I have the following KDL format:
inventory "base" {
var "name" {
value "value"
}
}
And I want to improve the error reporting in case the inventory name name is omitted:
inventory {
var "name" {
value "value"
}
}
At the moment, a rendered error gives me the following:
At: inventory #0
Expected arg #0
I'd like to be able to report an error saying Node inventory is expecting an argument "name" of type "text".
The parser looks like this at the moment:
KDL.nodeWith "inventory" $ do
name <- KDL.arg @Text
I guess I could use optional and throw a custom error if I see a Nothing?
Note that I adopt this syntax because the tool I'm building is aimed at people who are exposed to Terraform, which has HCL configuration such as:
module "outscale-vm" {
source = "../modules/outscale-vm"
vm_type = "tinav6.c2r4p1"
keypair_name = "bastion"
}
but if this is stretching the language / parser beyond what it's been made for, I can understand that I should use props instead.
Hi @brandonchinn178!
I have the following KDL format:
And I want to improve the error reporting in case the inventory name name is omitted:
At the moment, a rendered error gives me the following:
I'd like to be able to report an error saying
Node inventory is expecting an argument "name" of type "text".The parser looks like this at the moment:
I guess I could use
optionaland throw a custom error if I see aNothing?Note that I adopt this syntax because the tool I'm building is aimed at people who are exposed to Terraform, which has HCL configuration such as:
but if this is stretching the language / parser beyond what it's been made for, I can understand that I should use props instead.