openbao-helm/hack/helm-reference-gen/parse_error.go
2023-04-19 20:43:49 +01:00

23 lines
527 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package main
import "fmt"
// ParseError is an error that occurs during parsing.
// It's used to include information about which node failed to parse.
type ParseError struct {
ParentAnchor string
CurrAnchor string
FullAnchor string
Err string
}
func (p *ParseError) Error() string {
anchor := p.FullAnchor
if anchor == "" {
anchor = fmt.Sprintf("%s-%s", p.ParentAnchor, p.CurrAnchor)
}
return fmt.Sprintf("%s: %s", anchor, p.Err)
}