Use a better error message when trying to merge non-objects (#6805)

Fixes #6803

Signed-off-by: Anders Eknert <anders@styra.com>
This commit is contained in:
Anders Eknert
2024-06-11 09:46:08 +02:00
committed by GitHub
parent 6212f30619
commit b2146ed0c4
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ func (e *Errors) add(err error) {
type unsupportedDocumentType string
func (path unsupportedDocumentType) Error() string {
return string(path) + ": bad document type"
return string(path) + ": document must be of type object"
}
type unrecognizedFile string
+1 -1
View File
@@ -732,7 +732,7 @@ func TestLoadErrors(t *testing.T) {
}
expected := []string{
"bad_doc.json: bad document type",
"bad_doc.json: document must be of type object",
"a.json: EOF",
"b.yaml: error converting YAML to JSON",
"empty.rego:0: rego_parse_error: empty module",