diag

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MPL-2.0 Imports: 5 Imported by: 300

Documentation

Index

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 {
	// Err is the underlying go error this diagnostic wraps
	Err error
	// contains filtered or unexported fields
}

BaseError is a generic error returned when execution is run, satisfies Diagnostic interface

func NewBaseError

func NewBaseError(err error, severity Severity, dt DiagnosticType, resource, summary, details string) *BaseError

NewBaseError creates a BaseError from given error

func (BaseError) Description

func (e BaseError) Description() Description

func (BaseError) Error

func (e BaseError) Error() string

func (BaseError) Severity

func (e BaseError) Severity() Severity

func (BaseError) Type

func (e BaseError) Type() DiagnosticType

type Countable added in v0.7.6

type Countable interface {
	Count() uint64
}

type Description

type Description struct {
	Resource string
	Summary  string
	Detail   string
}

type Diagnostic

type Diagnostic interface {
	error
	Severity() Severity
	Type() DiagnosticType
	Description() Description
}

type DiagnosticType

type DiagnosticType int
const (
	UNKNOWN DiagnosticType = iota
	RESOLVING
	ACCESS
	THROTTLE
	DATABASE
	SCHEMA
	INTERNAL
)

func (DiagnosticType) String

func (d DiagnosticType) String() string

type Diagnostics

type Diagnostics []Diagnostic

func (Diagnostics) Add

func (diags Diagnostics) Add(new ...interface{}) Diagnostics

func (Diagnostics) CountBySeverity added in v0.7.6

func (diags Diagnostics) CountBySeverity(sev Severity) uint64

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) 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
	Type        DiagnosticType
	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

func (SquashedDiag) Description

func (s SquashedDiag) Description() Description

func (SquashedDiag) Redacted added in v0.7.6

func (s SquashedDiag) Redacted() Diagnostic

Jump to

Keyboard shortcuts

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