Documentation ¶
Index ¶
- func CountDiag(d Diagnostic) uint64
- func WrapError(err error) error
- type BaseError
- type BaseErrorOption
- func WithDetails(detail string, args ...interface{}) BaseErrorOption
- func WithError(err error) BaseErrorOption
- func WithNoOverwrite() BaseErrorOption
- func WithOptionalSeverity(s Severity) BaseErrorOption
- func WithResourceId(id []string) BaseErrorOption
- func WithResourceName(resource string) BaseErrorOption
- func WithSeverity(s Severity) BaseErrorOption
- func WithSummary(summary string, args ...interface{}) BaseErrorOption
- func WithType(dt Type) BaseErrorOption
- type Countable
- type Description
- type Diagnostic
- type Diagnostics
- func (diags Diagnostics) Add(new ...interface{}) Diagnostics
- func (diags Diagnostics) CountBySeverity(sev Severity, includeSquashed bool) uint64
- func (diags Diagnostics) Error() string
- func (diags Diagnostics) Errors() uint64
- func (diags Diagnostics) HasDiags() bool
- func (diags Diagnostics) HasErrors() bool
- func (diags Diagnostics) Len() int
- func (diags Diagnostics) Less(i, j int) bool
- func (diags Diagnostics) Redacted() Diagnostics
- func (diags Diagnostics) Squash() Diagnostics
- func (diags Diagnostics) Swap(i, j int)
- func (diags Diagnostics) Warnings() uint64
- type FlatDiag
- type Redactable
- type RedactedDiagnostic
- type Severity
- type SquashedDiag
- type Type
- type Unsquashable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountDiag ¶ added in v0.7.6
func CountDiag(d Diagnostic) uint64
Types ¶
type BaseError ¶
type BaseError struct {
// contains filtered or unexported fields
}
BaseError is a generic error returned when execution is run, satisfies Diagnostic interface
func NewBaseError ¶
func NewBaseError(err error, dt Type, opts ...BaseErrorOption) *BaseError
NewBaseError creates a BaseError from given error, except the given error is a BaseError itself
func (BaseError) Description ¶
func (e BaseError) Description() Description
type BaseErrorOption ¶ added in v0.8.0
type BaseErrorOption func(*BaseError)
func WithDetails ¶ added in v0.8.0
func WithDetails(detail string, args ...interface{}) BaseErrorOption
func WithError ¶ added in v0.8.5
func WithError(err error) BaseErrorOption
func WithNoOverwrite ¶ added in v0.8.0
func WithNoOverwrite() BaseErrorOption
WithNoOverwrite sets the noOverwrite flag of BaseError, active for the duration of the application of options Deprecated: Prefer using WithOptionalSeverity on the opposite side instead
func WithOptionalSeverity ¶ added in v0.8.14
func WithOptionalSeverity(s Severity) BaseErrorOption
func WithResourceId ¶ added in v0.8.0
func WithResourceId(id []string) BaseErrorOption
func WithResourceName ¶ added in v0.8.0
func WithResourceName(resource string) BaseErrorOption
func WithSeverity ¶ added in v0.8.0
func WithSeverity(s Severity) BaseErrorOption
func WithSummary ¶ added in v0.8.0
func WithSummary(summary string, args ...interface{}) BaseErrorOption
func WithType ¶ added in v0.8.0
func WithType(dt Type) BaseErrorOption
type Description ¶
type Diagnostic ¶
type Diagnostic interface { error Severity() Severity Type() Type Description() Description }
func UnsquashDiag ¶ added in v0.9.0
func UnsquashDiag(d Diagnostic) Diagnostic
type Diagnostics ¶
type Diagnostics []Diagnostic
func FromError ¶ added in v0.8.1
func FromError(err error, dt Type, opts ...BaseErrorOption) Diagnostics
FromError converts an error to Diagnostics, or return if it's already of type diagnostic(s). nil error returns nil value.
func (Diagnostics) Add ¶
func (diags Diagnostics) Add(new ...interface{}) Diagnostics
func (Diagnostics) CountBySeverity ¶ added in v0.7.6
func (diags Diagnostics) CountBySeverity(sev Severity, includeSquashed bool) uint64
CountBySeverity returns number of diagnostics of the given severity. If includeSquashed is false, squashed diags are counted as a single diag.
func (Diagnostics) Error ¶
func (diags Diagnostics) Error() string
func (Diagnostics) Errors ¶
func (diags Diagnostics) Errors() uint64
func (Diagnostics) HasDiags ¶
func (diags Diagnostics) HasDiags() bool
func (Diagnostics) HasErrors ¶
func (diags Diagnostics) HasErrors() bool
func (Diagnostics) Len ¶
func (diags Diagnostics) Len() int
func (Diagnostics) Less ¶
func (diags Diagnostics) Less(i, j int) bool
func (Diagnostics) Redacted ¶ added in v0.8.6
func (diags Diagnostics) Redacted() Diagnostics
func (Diagnostics) Squash ¶
func (diags Diagnostics) Squash() Diagnostics
Squash attempts to squash diagnostics
func (Diagnostics) Swap ¶
func (diags Diagnostics) Swap(i, j int)
func (Diagnostics) Warnings ¶
func (diags Diagnostics) Warnings() uint64
type FlatDiag ¶
type FlatDiag struct { Err string Resource string ResourceID []string Type Type Severity Severity Summary string Description Description }
FlatDiag is a structured diagnostic, usually can be used to create a json of diagnostics or testing.
func FlattenDiags ¶
func FlattenDiags(dd Diagnostics, skipDescription bool) []FlatDiag
FlattenDiags converts Diagnostics to an array of FlatDiag
type Redactable ¶
type Redactable interface {
Redacted() Diagnostic
}
type RedactedDiagnostic ¶
type RedactedDiagnostic struct { Diagnostic // contains filtered or unexported fields }
func NewRedactedDiagnostic ¶
func NewRedactedDiagnostic(vanilla, redacted Diagnostic) RedactedDiagnostic
func (RedactedDiagnostic) Redacted ¶
func (p RedactedDiagnostic) Redacted() Diagnostic
type Severity ¶
type Severity int
const ( // IGNORE severity is set for diagnostics that were ignored by the SDK IGNORE Severity = iota // WARNING severity are diagnostics that should be fixed but aren't fatal to the fetch execution WARNING // ERROR severity are diagnostics that were fatal in the fetch execution and should be fixed. ERROR // PANIC severity are diagnostics that are returned from a panic in the underlying code. PANIC )
type SquashedDiag ¶
type SquashedDiag struct { Diagnostic // contains filtered or unexported fields }
func (SquashedDiag) Count ¶
func (s SquashedDiag) Count() uint64
Count returns the number of diagnostics inside the squashed diagnostic
func (SquashedDiag) Description ¶
func (s SquashedDiag) Description() Description
func (SquashedDiag) Redacted ¶ added in v0.7.6
func (s SquashedDiag) Redacted() Diagnostic
Redacted returns the redacted version of the first diagnostic, if there is any
func (SquashedDiag) Unsquash ¶ added in v0.9.0
func (s SquashedDiag) Unsquash() Diagnostic
Unsquash returns the first diagnostic of the squashed set
type Unsquashable ¶ added in v0.9.0
type Unsquashable interface {
Unsquash() Diagnostic
}