Documentation
¶
Index ¶
- Variables
- func DiagnosticsGetExtra[T any](diags Diag) (extra T, found bool)
- func FindByExtra[T any](diags Diag) *hcl.Diagnostic
- func GetExtra[T any](diag *hcl.Diagnostic) (extra T, found bool)
- func PrintDiags(output io.Writer, diags []*hcl.Diagnostic, fileMap map[string]*hcl.File, ...)
- type DefaultSubject
- type DefaultSummary
- type Diag
- func (d *Diag) Add(summary, detail string)
- func (d *Diag) AddWarn(summary, detail string)
- func (d *Diag) Append(diag *hcl.Diagnostic) (addedErrors bool)
- func (d *Diag) AppendErr(err error, summary string) (haveAddedErrors bool)
- func (d Diag) Error() string
- func (d *Diag) Extend(diags []*hcl.Diagnostic) (haveAddedErrors bool)
- func (d Diag) HasErrors() bool
- func (d Diag) Refine(refiners ...Refiner) Diag
- type GoJQError
- type PathExtra
- type Refiner
- type TracebackExtra
Constants ¶
This section is empty.
Variables ¶
var RepeatedError = &hcl.Diagnostic{ Severity: hcl.DiagError, Extra: repeatedError{}, }
Invisible to user error, typically used to signal that the initial block evaluation has failed (and already has reported its errors to user).
Functions ¶
func DiagnosticsGetExtra ¶
DiagnosticsGetExtra finds the first extra of type T in the slice of provided diagnostics
func FindByExtra ¶
func FindByExtra[T any](diags Diag) *hcl.Diagnostic
func GetExtra ¶
func GetExtra[T any](diag *hcl.Diagnostic) (extra T, found bool)
GetExtra finds extra of type T in a provided diagnostic
func PrintDiags ¶
Types ¶
type DefaultSubject ¶
Set Subject field if empty
func (DefaultSubject) Refine ¶
func (ds DefaultSubject) Refine(diags Diag)
type DefaultSummary ¶
type DefaultSummary string
Set Summary field if empty
func (DefaultSummary) Refine ¶
func (ds DefaultSummary) Refine(diags Diag)
type Diag ¶
type Diag hcl.Diagnostics // Diagnostics does implement error interface, but is not, itself, an error.
func FromHcl ¶
func FromHcl(diag *hcl.Diagnostic) Diag
func (*Diag) Append ¶
func (d *Diag) Append(diag *hcl.Diagnostic) (addedErrors bool)
Appends diag to diagnostics, returns true if the just-appended diagnostic is an error.
func (*Diag) Extend ¶
func (d *Diag) Extend(diags []*hcl.Diagnostic) (haveAddedErrors bool)
Appends all diags to diagnostics, returns true if the just-appended diagnostics contain an error.
type GoJQError ¶ added in v0.4.2
Attach this as an .Extra on diagnostic to enhance the error message for gojq errors. Diagnostic must include Subject pointing to the query expression.
type PathExtra ¶ added in v0.4.2
type PathExtra struct {
// contains filtered or unexported fields
}
func AddPath ¶
Stores path in hcl.Diagnostic.Extra, or via Diag.Refine. Add path, prepending if any already exist.
func DefaultPath ¶
Adds path to diagnostics that do not have a path already
type TracebackExtra ¶ added in v0.4.2
type TracebackExtra = *tracebackExtra
func NewTracebackExtra ¶ added in v0.4.2
func NewTracebackExtra() TracebackExtra