change err msg

This commit is contained in:
Alexander Wang 2025-03-23 07:30:24 -06:00
parent 74e64ca3d0
commit 8b4b4a72c7
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
5 changed files with 7 additions and 7 deletions

View file

@ -328,7 +328,7 @@ containers: {
Steps
}
`,
expErr: `d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps is only allowed at a board root`,
expErr: `d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps must be declared at a board root scope`,
},
{
name: "name-with-dot-underscore",
@ -1746,7 +1746,7 @@ c: {
}
`,
},
expErr: `d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers is only allowed at a board root`,
expErr: `d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers must be declared at a board root scope`,
},
{
name: "import_url_link",

View file

@ -593,7 +593,7 @@ classes: {
}
}
`)
assert.ErrorString(t, err, `TestCompile/classes/nonroot.d2:2:3: classes is only allowed at a board root`)
assert.ErrorString(t, err, `TestCompile/classes/nonroot.d2:2:3: classes must be declared at a board root scope`)
},
},
{

View file

@ -942,11 +942,11 @@ func (m *Map) ensureField(i int, kp *d2ast.KeyPath, refctx *RefContext, create b
}
if headString == "classes" && head.IsUnquoted() && NodeBoardKind(m) == "" {
return d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a board root", headString)
return d2parser.Errorf(kp.Path[i].Unbox(), "%s must be declared at a board root scope", headString)
}
if findBoardKeyword(head) != -1 && head.IsUnquoted() && NodeBoardKind(m) == "" {
return d2parser.Errorf(kp.Path[i].Unbox(), "%s is only allowed at a board root", headString)
return d2parser.Errorf(kp.Path[i].Unbox(), "%s must be declared at a board root scope", headString)
}
for _, f := range m.Fields {

View file

@ -4,7 +4,7 @@
"errs": [
{
"range": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2,3:2:115-3:7:120",
"errmsg": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps is only allowed at a board root"
"errmsg": "d2/testdata/d2compiler/TestCompile/image_children_Steps.d2:4:3: steps must be declared at a board root scope"
}
]
}

View file

@ -4,7 +4,7 @@
"errs": [
{
"range": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2,9:6:75-9:12:81",
"errmsg": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers is only allowed at a board root"
"errmsg": "d2/testdata/d2compiler/TestCompile/import-classes-boards.d2:10:7: layers must be declared at a board root scope"
}
]
}