errs

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As[T error](err error) (T, bool)

As is equivalent to errors.As(), but returns the value in-line

func AsContains

func AsContains(err error, target any, message string) bool

func Contains

func Contains(err error, needle string) bool

Contains returns true if the error matches all these conditions:

  • err as string contains needle

func FromAttributeError

func FromAttributeError(path cty.Path, err error) diag.Diagnostic

func IsA

func IsA[T error](err error) bool

IsA indicates whether an error matches an error type

func IsAErrorMessageContains

func IsAErrorMessageContains[T ErrorWithErrorMessage](err error, needle string) bool

IsAErrorMessageContains returns whether or not the specified error is of the specified type and its ErrorMessage() value contains the specified needle.

func IsUnsupportedOperationInPartitionError

func IsUnsupportedOperationInPartitionError(partition string, err error) bool

IsUnsupportedOperationInPartitionError checks the partition and specific error to make an educated guess about whether the problem stems from a feature not being available in a non-standard partitions (e.g. ISO) that is normally available. A return value of `true` means that there is an error AND it suggests a feature is not supported in ISO. Be careful with a return value of `false“, which means either there is NO error or there is an error but not one that suggests an unsupported feature in ISO.

func MessageContains

func MessageContains(err error, code string, message string) bool

MessageContains unwraps the error and returns true if the error matches all these conditions:

  • err is of type awserr.Error, Error.Code() equals code, and Error.Message() contains message
  • OR err if not of type awserr.Error as string contains both code and message

func Must

func Must[T any](x T, err error) T

Must is a generic implementation of the Go Must idiom [1, 2]. It panics if the provided error is non-nil and returns x otherwise.

func NewAttributeErrorDiagnostic

func NewAttributeErrorDiagnostic(path cty.Path, summary, detail string) diag.Diagnostic

func NewAttributeWarningDiagnostic

func NewAttributeWarningDiagnostic(path cty.Path, summary, detail string) diag.Diagnostic

func NewErrorDiagnostic

func NewErrorDiagnostic(summary, detail string) diag.Diagnostic

func NewIncorrectValueTypeAttributeError

func NewIncorrectValueTypeAttributeError(path cty.Path, expected string) diag.Diagnostic

func NewInvalidValueAttributeError

func NewInvalidValueAttributeError(path cty.Path, detail string) diag.Diagnostic

func NewInvalidValueAttributeErrorf

func NewInvalidValueAttributeErrorf(path cty.Path, format string, a ...any) diag.Diagnostic

func NewWarningDiagnostic

func NewWarningDiagnostic(summary, detail string) diag.Diagnostic

Types

type ErrorWithErrorMessage

type ErrorWithErrorMessage interface {
	error
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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