Skip to content

Commit 6d2de15

Browse files
committed
Add ExpectedScalarOrMap error
1 parent 4299e11 commit 6d2de15

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

errors/parse.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ var (
4343
ErrExpectedInt = fmt.Errorf(
4444
"%w: expected int value", ErrParse,
4545
)
46+
// ErrExpectedScalarOrMap indicates that we did not find an expected
47+
// scalar or map field
48+
ErrExpectedScalarOrMap = fmt.Errorf(
49+
"%w: expected scalar or map field", ErrParse,
50+
)
4651
// ErrExpectedScalarOrSequence indicates that we did not find an expected
4752
// scalar or sequence of scalars field
4853
ErrExpectedScalarOrSequence = fmt.Errorf(
@@ -126,6 +131,15 @@ func ExpectedScalarOrSequenceAt(node *yaml.Node) error {
126131
)
127132
}
128133

134+
// ExpectedScalarOrMapAt returns an ErrExpectedScalarOrMap error annotated with
135+
// the line/column of the supplied YAML node.
136+
func ExpectedScalarOrMapAt(node *yaml.Node) error {
137+
return fmt.Errorf(
138+
"%w at line %d, column %d",
139+
ErrExpectedScalarOrMap, node.Line, node.Column,
140+
)
141+
}
142+
129143
// ExpectedTimeoutAt returns an ErrExpectedTimeout error annotated
130144
// with the line/column of the supplied YAML node.
131145
func ExpectedTimeoutAt(node *yaml.Node) error {

0 commit comments

Comments
 (0)