diagnostics

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 FindByExtra

func FindByExtra[T any](diags Diag) *hcl.Diagnostic

func PrintDiags

func PrintDiags(output *os.File, diags Diag, fileMap map[string]*hcl.File, colorize bool)

Types

type Diag

type Diag hcl.Diagnostics // Diagnostics does implement error interface, but not, itself, an error.

func FromErr

func FromErr(err error, summary string) Diag

func FromErrSubj

func FromErrSubj(err error, summary string, subject *hcl.Range) Diag

func FromHcl

func FromHcl(diag *hcl.Diagnostic) Diag

func (*Diag) Add

func (d *Diag) Add(summary, detail string)

Add new diagnostic error.

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) AppendErr

func (d *Diag) AppendErr(err error, summary string) (haveAddedErrors bool)

Creates diagnostic and appends it if err != nil.

func (Diag) Error

func (d Diag) Error() string

func (*Diag) Extend

func (d *Diag) Extend(diags Diag) (haveAddedErrors bool)

Appends all diags to diagnostics, returns true if the just-appended diagnostics contain an error.

func (*Diag) ExtendHcl

func (d *Diag) ExtendHcl(diags hcl.Diagnostics) (haveAddedErrors bool)

Appends all diags to diagnostics, returns true if the just-appended diagnostics contain an error.

func (*Diag) HasErrors

func (d *Diag) HasErrors() bool

HasErrors returns true if the receiver contains any diagnostics of severity DiagError.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL