error_helpers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: AGPL-3.0 Imports: 17 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidCloudTokenError = fmt.Errorf("Invalid token.\nPlease run %s or setup a token.", constants.Bold("steampipe login"))
View Source
var InvalidStateError = errors.New("invalid state")
View Source
var MissingCloudTokenError = fmt.Errorf("Not authenticated for Turbot Pipes.\nPlease run %s or setup a token.", constants.Bold("steampipe login"))
View Source
var PluginSdkCompatibilityError = fmt.Sprintf("plugins using SDK version < v4 are no longer supported. Upgrade by running %s", constants.Bold("steampipe plugin update --all"))

PluginSdkCompatibilityError is raised when aplugin is built using na incompatible sdk version

Functions

func CombineErrors

func CombineErrors(errors ...error) error

func CombineErrorsWithPrefix

func CombineErrorsWithPrefix(prefix string, errors ...error) error

func DecodePgError

func DecodePgError(err error) error

func DiagsToError

func DiagsToError(prefix string, diags tfdiags.Diagnostics) error

DiagsToError converts tfdiags diags into an error

func FailOnError

func FailOnError(err error)

func FailOnErrorWithMessage

func FailOnErrorWithMessage(err error, message string)

func HandleCancelError

func HandleCancelError(err error) error

HandleCancelError modifies a context.Canceled error into a readable error that can be printed on the console

func HandleQueryTimeoutError

func HandleQueryTimeoutError(err error) error

func HclDiagsToError

func HclDiagsToError(prefix string, diags hcl.Diagnostics) error

func IsCancelledError

func IsCancelledError(err error) bool

func IsContextCanceled

func IsContextCanceled(ctx context.Context) bool

func IsContextCancelledError

func IsContextCancelledError(err error) bool

func IsInvalidCloudToken

func IsInvalidCloudToken(err error) bool

func IsInvalidWorkspaceDatabaseArg

func IsInvalidWorkspaceDatabaseArg(err error) bool

func MergeErrors

func MergeErrors(errs []error) []string

func PrefixError

func PrefixError(err error, prefix string) error

func ShowError

func ShowError(ctx context.Context, err error)

func ShowErrorWithMessage

func ShowErrorWithMessage(ctx context.Context, err error, message string)

ShowErrorWithMessage displays the given error nicely with the given message

func ShowWarning

func ShowWarning(warning string)

func TransformErrorToSteampipe

func TransformErrorToSteampipe(err error) error

TransformErrorToSteampipe removes the pq: and rpc error prefixes along with all the unnecessary information that comes from the drivers and libraries

func WrapError

func WrapError(err error) error

Types

type ErrorAndWarnings

type ErrorAndWarnings struct {
	Error    error
	Warnings []string
}

func DiagsToErrorsAndWarnings

func DiagsToErrorsAndWarnings(errPrefix string, diags hcl.Diagnostics) *ErrorAndWarnings

func EmptyErrorsAndWarning

func EmptyErrorsAndWarning() *ErrorAndWarnings

func NewErrorsAndWarning

func NewErrorsAndWarning(err error, warnings ...string) *ErrorAndWarnings

func (*ErrorAndWarnings) AddWarning

func (r *ErrorAndWarnings) AddWarning(warnings ...string)

func (*ErrorAndWarnings) Empty

func (r *ErrorAndWarnings) Empty() bool

func (*ErrorAndWarnings) GetError

func (r *ErrorAndWarnings) GetError() error

func (*ErrorAndWarnings) Merge

func (*ErrorAndWarnings) ShowWarnings

func (r *ErrorAndWarnings) ShowWarnings()

func (*ErrorAndWarnings) WrapErrorWithMessage

func (r *ErrorAndWarnings) WrapErrorWithMessage(msg string) *ErrorAndWarnings

Jump to

Keyboard shortcuts

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