Skip to content

Commit

Permalink
Merge pull request #15 from gdt-dev/parse-errors
Browse files Browse the repository at this point in the history
Add ExpectedScalarOrMap error
  • Loading branch information
jaypipes authored Aug 14, 2023
2 parents c7111ed + 6d2de15 commit 1360915
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions errors/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ var (
ErrExpectedInt = fmt.Errorf(
"%w: expected int value", ErrParse,
)
// ErrExpectedScalarOrMap indicates that we did not find an expected
// scalar or map field
ErrExpectedScalarOrMap = fmt.Errorf(
"%w: expected scalar or map field", ErrParse,
)
// ErrExpectedScalarOrSequence indicates that we did not find an expected
// scalar or sequence of scalars field
ErrExpectedScalarOrSequence = fmt.Errorf(
Expand Down Expand Up @@ -126,6 +131,15 @@ func ExpectedScalarOrSequenceAt(node *yaml.Node) error {
)
}

// ExpectedScalarOrMapAt returns an ErrExpectedScalarOrMap error annotated with
// the line/column of the supplied YAML node.
func ExpectedScalarOrMapAt(node *yaml.Node) error {
return fmt.Errorf(
"%w at line %d, column %d",
ErrExpectedScalarOrMap, node.Line, node.Column,
)
}

// ExpectedTimeoutAt returns an ErrExpectedTimeout error annotated
// with the line/column of the supplied YAML node.
func ExpectedTimeoutAt(node *yaml.Node) error {
Expand Down

0 comments on commit 1360915

Please sign in to comment.