errs

package
v6.0.0-...-02ba6c8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIError

func APIError[T ~string](code T, message string) smithy.APIError

APIError returns a new error suitable for checking via aws-sdk-go-base/tfawserr.

func As

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

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

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 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 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 NewAtLeastOneOfChildrenError

func NewAtLeastOneOfChildrenError(parentPath cty.Path, paths ...cty.Path) diag.Diagnostic

NewAtLeastOneOfChildrenError returns an error diagnostic indicating that at least on of the named children of parentPath is required.

func NewAttributeConflictsWhenError

func NewAttributeConflictsWhenError(path, otherPath cty.Path, otherValue string) diag.Diagnostic

NewAttributeConflictsWhenError returns an error diagnostic indicating that the attribute at the given path cannot be specified when the attribute at otherPath has the given value.

func NewAttributeConflictsWhenWillBeError

func NewAttributeConflictsWhenWillBeError(path, otherPath cty.Path, otherValue string) diag.Diagnostic

NewAttributeConflictsWhenWillBeError returns a warning diagnostic indicating that the attribute at the given path cannot be specified when the attribute at otherPath has the given value. This is intended to be used for situations where the conflict will become an error in a future release.

func NewAttributeErrorDiagnostic

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

func NewAttributeRequiredError

func NewAttributeRequiredError(parentPath cty.Path, attrname string) diag.Diagnostic

NewAttributeRequiredWhenError should only be used for apply-time validation, as it replicates the functionality of a `Required` attribute

func NewAttributeRequiredWhenError

func NewAttributeRequiredWhenError(neededPath, otherPath cty.Path, value string) diag.Diagnostic

NewAttributeRequiredWhenError returns an error diagnostic indicating that the attribute at neededPath is required when the attribute at otherPath has the given value.

func NewAttributeRequiredWillBeError

func NewAttributeRequiredWillBeError(parentPath cty.Path, attrname string) diag.Diagnostic

NewAttributeRequiredWillBeError returns a warning diagnostic indicating that the attribute at the given path is required. This is intended to be used for situations where the missing attribute will be an error in a future release.

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

func PathString

func PathString(path cty.Path) string

Types

type ErrorWithErrorMessage

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

type MessageError

type MessageError struct {
	// contains filtered or unexported fields
}

MessageError is a simple error type that implements the errorMessager

func NewMessageError

func NewMessageError(err error) *MessageError

NewMessageError returns a new MessageError

func (*MessageError) ErrorMessage

func (e *MessageError) ErrorMessage() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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