errors

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiagnosticString added in v1.31.0

func DiagnosticString(d diag.Diagnostic) string

DiagnosticString formats a Diagnostic If there is no `Detail`, only prints summary, otherwise prints both

func DiagnosticsError added in v1.31.0

func DiagnosticsError(diags diag.Diagnostics) error

DiagnosticsError returns an error containing all Diagnostic with SeverityError

func FormatFabricError added in v1.21.0

func FormatFabricError(err error) error

func FriendlyError

func FriendlyError(err error) error

FriendlyError improves error messages when the API error is blank or in an alternate format (as is the case with invalid token or loadbalancer errors)

func FriendlyErrorForMetalGo

func FriendlyErrorForMetalGo(err error, resp *http.Response) error

func HasApplicationErrorCode added in v1.23.0

func HasApplicationErrorCode(errors []rest.ApplicationError, code string) bool

func HasErrorCode added in v1.36.0

func HasErrorCode(errors []fabricv4.Error, code string) bool

func HttpForbidden

func HttpForbidden(resp *http.Response, err error) bool

func HttpNotFound

func HttpNotFound(resp *http.Response, err error) bool

func IgnoreHttpResponseErrors added in v1.26.0

func IgnoreHttpResponseErrors(ignore ...func(resp *http.Response, err error) bool) func(resp *http.Response, err error) error

ignoreHttpResponseErrors ignores http response errors when matched by one of the provided checks

func IgnoreResponseErrors

func IgnoreResponseErrors(ignore ...func(resp *http.Response, err error) bool) func(resp *packngo.Response, err error) error

ignoreResponseErrors ignores http response errors when matched by one of the provided checks

func IsForbidden

func IsForbidden(err error) bool

func IsNotAssigned

func IsNotAssigned(resp *http.Response, err error) bool

IsNotAssigned matches errors reported from unassigned virtual networks

func IsNotFound

func IsNotFound(err error) bool

func IsRestNotFoundError added in v1.23.0

func IsRestNotFoundError(err error) bool

func Must added in v1.31.0

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 MustWithDiagnostics added in v1.31.0

func MustWithDiagnostics[T any](x T, diags diag.Diagnostics) T

MustWithDiagnostics is a generic implementation of the Go Must idiom [1, 2]. It panics if the provided Diagnostics has errors and returns x otherwise.

func NewResourceNotFoundWarningDiagnostic added in v1.31.0

func NewResourceNotFoundWarningDiagnostic(err error) diag.Diagnostic

Types

type ErrorResponse

type ErrorResponse struct {
	StatusCode int
	Errors
	IsAPIError bool
}

func (*ErrorResponse) Error

func (er *ErrorResponse) Error() string

type Errors

type Errors []string

func (Errors) Error

func (e Errors) Error() string

Jump to

Keyboard shortcuts

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