Documentation ¶
Overview ¶
Package util ...
Package util ...
Package util ...
Package util ...
Package util ...
Index ¶
- Constants
- func ErrorDeepUnwrapString(err error) []string
- func ErrorReasonCode(err error) reasoncode.ReasonCode
- func ErrorToFault(err error) *provider.Fault
- func FaultToError(fault *provider.Fault) error
- func GetErrorType(err error) string
- func NewError(code reasoncode.ReasonCode, msg string, wrapped ...error) error
- func NewErrorWithProperties(code reasoncode.ReasonCode, msg string, properties map[string]string, ...) error
- func SafeStringValue(s *string) string
- func SetFaultResponse(fault error, response interface{}) error
- func StringHasValue(s *string) bool
- func TimeTracker(functionName string, start time.Time)
- func ZapError(err error) zapcore.Field
- type ErrorRetrier
- type Message
Constants ¶
const ( // FailedAccessToken ... FailedAccessToken = "FailedAccessToken" // ProvisioningFailed volume or snapshot provisioning failed ProvisioningFailed = "ProvisioningFailed" // DeletionFailed ... DeletionFailed = "DeletionFailed" // UpdateFailed ... UpdateFailed = "UpdateFailed" // RetrivalFailed ... RetrivalFailed = "RetrivalFailed" // InvalidRequest ... InvalidRequest = "InvalidRequest" // EntityNotFound ... EntityNotFound = "EntityNotFound" // PermissionDenied ... PermissionDenied = "PermissionDenied" // Unauthenticated ... Unauthenticated = "Unauthenticated" // ErrorTypeFailed ... ErrorTypeFailed = "ErrorTypeConversionFailed" // VolumeAttachFindFailed ... VolumeAttachFindFailed = "VolumeAttachFindFailed" // AttachFailed ... AttachFailed = "AttachFailed" // VolumeAccessPointFindFailed ... VolumeAccessPointFindFailed = "VolumeAccessPointFindFailed" // CreateVolumeAccessPointFailed ... CreateVolumeAccessPointFailed = "CreateVolumeAccessPointFailed" // DeleteVolumeAccessPointFailed ... DeleteVolumeAccessPointFailed = "DeleteVolumeAccessPointFailed" // InstanceNotFound ... NodeNotFound = "NodeNotFound" // DetachFailed ... DetachFailed = "DetachFailed" // ExpansionFailed ... ExpansionFailed = "ExpansionFailed" )
These are the error types which all provider should categorize their errors
Variables ¶
This section is empty.
Functions ¶
func ErrorDeepUnwrapString ¶
ErrorDeepUnwrapString returns the full list of unwrapped error strings Returns empty slice if not a provider.Error
func ErrorReasonCode ¶
func ErrorReasonCode(err error) reasoncode.ReasonCode
ErrorReasonCode returns reason code if a provider.Error, else ErrorUnclassified
func ErrorToFault ¶
ErrorToFault returns or builds a Fault pointer for an error (e.g. for a response object) Returns nil if no error,
func FaultToError ¶
FaultToError builds a Error from a Fault pointer (e.g. from a response object) Returns nil error if no Fault.
func GetErrorType ¶
GetErrorType return the user error type provided by volume provider
func NewError ¶
func NewError(code reasoncode.ReasonCode, msg string, wrapped ...error) error
NewError returns an error that is implemented by provider.Error. If optional wrapped errors are a provider.Error, this preserves all child wrapped errors in depth-first order.
func NewErrorWithProperties ¶
func NewErrorWithProperties(code reasoncode.ReasonCode, msg string, properties map[string]string, wrapped ...error) error
NewErrorWithProperties returns an error that is implemented provider.Error and which is decorated with diagnostic properties. If optional wrapped errors are a provider.Error, this preserves all child wrapped errors in depth-first order.
func SafeStringValue ¶
SafeStringValue returns the referenced string value, treating nil as equivalent to "". It is intended as a type-safe and nil-safe test for empty values in data fields of
func SetFaultResponse ¶
SetFaultResponse sets the Fault field of any response struct
func StringHasValue ¶
StringHasValue returns true if the argument is neither nil nor a pointer to the zero/empty string.
func TimeTracker ¶
TimeTracker Get execution time of a function
Types ¶
type ErrorRetrier ¶
ErrorRetrier retry the function
func NewErrorRetrier ¶
NewErrorRetrier return new ErrorRetrier
func (*ErrorRetrier) ErrorRetry ¶
func (er *ErrorRetrier) ErrorRetry(funcToRetry func() (error, bool)) error
ErrorRetry path for retry logic with logger passed in