errors

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 1 Imported by: 20

Documentation

Index

Constants

View Source
const (
	// LevelWarn is for Errors that should be addressed but do not have to be.
	LevelWarn = "Warning"
	// LevelError is for Errors that must be addressed.
	LevelError = "Error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// Type is the ErrorType string constant that represents the kind of
	// error, ex. "MandatoryStructMissing", "I/O".
	Type ErrorType
	// Level is the severity of the Error.
	Level Level
	// Field is the dot-hierarchical YAML path of the missing data.
	Field string
	// BadValue is the field or file that caused an error or warning.
	BadValue interface{}
	// Detail represents the error message as a string.
	Detail string
}

Error is an implementation of the 'error' interface, which represents a warning or an error in a yaml file.

func ErrFailedValidation

func ErrFailedValidation(detail string, value interface{}) Error

func ErrFieldMissing

func ErrFieldMissing(detail string, field string, value interface{}) Error

func ErrIOError

func ErrIOError(detail string, value interface{}) Error

func ErrInvalidBundle

func ErrInvalidBundle(detail string, value interface{}) Error

func ErrInvalidCSV

func ErrInvalidCSV(detail, csvName string) Error

func ErrInvalidManifestStructure

func ErrInvalidManifestStructure(detail string) Error

func ErrInvalidObject

func ErrInvalidObject(value interface{}, detail string) Error

func ErrInvalidOperation

func ErrInvalidOperation(detail string, value interface{}) Error

func ErrInvalidPackageManifest

func ErrInvalidPackageManifest(detail string, pkgName string) Error

func ErrInvalidParse

func ErrInvalidParse(detail string, value interface{}) Error

TODO: see if more information can be extracted out of 'unmarshall/parsing' errors.

func ErrUnsupportedType

func ErrUnsupportedType(detail string) Error

func NewError

func NewError(t ErrorType, detail, field string, v interface{}) Error

func NewWarn

func NewWarn(t ErrorType, detail, field string, v interface{}) Error

func WarnDeprecatedValidator added in v0.19.0

func WarnDeprecatedValidator(detail string) Error

func WarnFailedValidation

func WarnFailedValidation(detail string, value interface{}) Error

func WarnFieldMissing

func WarnFieldMissing(detail string, field string, value interface{}) Error

func WarnIOError

func WarnIOError(detail string, value interface{}) Error

func WarnInvalidBundle

func WarnInvalidBundle(detail string, value interface{}) Error

func WarnInvalidCSV

func WarnInvalidCSV(detail, csvName string) Error

func WarnInvalidManifestStructure

func WarnInvalidManifestStructure(detail string) Error

func WarnInvalidObject

func WarnInvalidObject(detail string, value interface{}) Error

func WarnInvalidOperation

func WarnInvalidOperation(detail string, value interface{}) Error

func WarnInvalidPackageManifest

func WarnInvalidPackageManifest(detail string, pkgName string) Error

func WarnInvalidParse

func WarnInvalidParse(detail string, value interface{}) Error

func WarnPropertiesAnnotationUsed added in v0.14.0

func WarnPropertiesAnnotationUsed(detail string) Error

func WarnUnsupportedType

func WarnUnsupportedType(detail string) Error

func (Error) Error

func (e Error) Error() string

Error implements the 'error' interface to define custom error formatting.

type ErrorType

type ErrorType string

ErrorType defines what the error resulted from.

const (
	ErrorInvalidCSV               ErrorType = "CSVFileNotValid"
	ErrorFieldMissing             ErrorType = "FieldNotFound"
	ErrorUnsupportedType          ErrorType = "FieldTypeNotSupported"
	ErrorInvalidParse             ErrorType = "ParseError"
	ErrorIO                       ErrorType = "FileReadError"
	ErrorFailedValidation         ErrorType = "ValidationFailed"
	ErrorInvalidOperation         ErrorType = "OperationFailed"
	ErrorInvalidManifestStructure ErrorType = "ManifestStructureNotValid"
	ErrorInvalidBundle            ErrorType = "BundleNotValid"
	ErrorInvalidPackageManifest   ErrorType = "PackageManifestNotValid"
	ErrorObjectFailedValidation   ErrorType = "ObjectFailedValidation"
	ErrorPropertiesAnnotationUsed ErrorType = "PropertiesAnnotationUsed"
	ErrorDeprecatedValidator      ErrorType = "DeprecatedValidator"
)

type Level

type Level string

Level is the severity of an Error.

type ManifestResult

type ManifestResult struct {
	// Name is some piece of information identifying the manifest.
	Name string
	// Errors pertain to issues with the manifest that must be corrected.
	Errors []Error
	// Warnings pertain to issues with the manifest that are optional to correct.
	Warnings []Error
}

ManifestResult represents verification result for each of the yaml files from the operator manifest.

func (*ManifestResult) Add

func (r *ManifestResult) Add(errs ...Error)

Add appends errs to r in either r.Errors or r.Warnings depending on an error's Level.

func (ManifestResult) HasError

func (r ManifestResult) HasError() bool

HasError returns true if r has any Errors of Level == LevelError.

func (ManifestResult) HasWarn

func (r ManifestResult) HasWarn() bool

HasWarn returns true if r has any Errors of Level == LevelWarn.

Jump to

Keyboard shortcuts

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