topdown/rego: Add BuiltinErrorList support to rego package, add to eval command (#5487)
```
$ cat pol.rego
package play
this_errors(number) := result {
result := number / 0
}
this_errors_too(number) := result {
result := number / 0
}
res1 := this_errors(1)
res2 := this_errors_too(1)
$ go run main.go eval --show-builtin-errors -d pol.rego data.play
{
"errors": [
{
"message": "div: divide by zero",
"code": "eval_builtin_error",
"location": {
"file": "pol.rego",
"row": 4,
"col": 12
}
},
{
"message": "div: divide by zero",
"code": "eval_builtin_error",
"location": {
"file": "pol.rego",
"row": 8,
"col": 12
}
}
],
"result": [
{
"expressions": [
{
"value": {},
"text": "data.play",
"location": {
"row": 1,
"col": 1
}
}
]
}
]
}
```
Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com> C
Charlie Egan committed
ac64e78c6979ce9cba161d94e69b62d477f74f3b
Parent: 36fdcef
Committed by GitHub <noreply@github.com>
on 1/3/2023, 1:25:49 PM