Documentation ¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the Apache v2.0 license.
Index ¶
- Variables
- func ErrorToProto(err error) *common.Error
- func GetErrorCode(err error) string
- func GetGRPCError(err error) error
- func GetGRPCErrorCode(err error) codes.Code
- func GetMocErrorCode(err error) moccodes.MocCode
- func IsAccessDenied(err error) bool
- func IsAlreadyExists(err error) bool
- func IsAlreadySet(err error) bool
- func IsBlobNotFound(err error) bool
- func IsDegraded(err error) bool
- func IsDeleteFailed(err error) bool
- func IsDeletePending(err error) bool
- func IsDuplicates(err error) bool
- func IsErrDeadlineExceeded(err error) bool
- func IsExpired(err error) bool
- func IsFailed(err error) bool
- func IsFileNotFound(err error) bool
- func IsGRPCAborted(err error) bool
- func IsGRPCAlreadyExist(err error) bool
- func IsGRPCDeadlineExceeded(err error) bool
- func IsGRPCNotFound(err error) bool
- func IsGRPCUnavailable(err error) bool
- func IsGRPCUnknown(err error) bool
- func IsGenericFailure(err error) bool
- func IsIPOutOfRange(err error) bool
- func IsInUse(err error) bool
- func IsInconsistentState(err error) bool
- func IsInvalidConfiguration(err error) bool
- func IsInvalidFilter(err error) bool
- func IsInvalidGroup(err error) bool
- func IsInvalidInput(err error) bool
- func IsInvalidToken(err error) bool
- func IsInvalidType(err error) bool
- func IsInvalidVersion(err error) bool
- func IsMeasurementUnitError(err error) bool
- func IsMocErrorCode(err error, code moccodes.MocCode) bool
- func IsNoActionTaken(err error) bool
- func IsNoAuthenticationInformation(err error) bool
- func IsNotEnoughSpace(err error) bool
- func IsNotFound(err error) bool
- func IsNotImplemented(err error) bool
- func IsNotInitialized(err error) bool
- func IsNotSet(err error) bool
- func IsNotSupported(err error) bool
- func IsOldVersion(err error) bool
- func IsOutOfCapacity(err error) bool
- func IsOutOfMemory(err error) bool
- func IsOutOfNodeCapacity(err error) bool
- func IsOutOfRange(err error) bool
- func IsPathNotFound(err error) bool
- func IsPendingState(err error) bool
- func IsPoolFull(err error) bool
- func IsQuotaViolation(err error) bool
- func IsRevoked(err error) bool
- func IsRunCommandFailed(err error) bool
- func IsTimeout(err error) bool
- func IsUnknown(err error) bool
- func IsUpdateFailed(err error) bool
- func IsWrongHost(err error) bool
- func New(errString string) error
- func NewMocError(code moccodes.MocCode) error
- func ParseGRPCError(err error) error
- func ProtoToMocError(protoErr *common.Error) error
- func Wrap(cause error, message string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type MocError
Constants ¶
This section is empty.
Variables ¶
var ( NotFound error = NewMocError(moccodes.NotFound) Degraded error = NewMocError(moccodes.Degraded) InvalidConfiguration error = NewMocError(moccodes.InvalidConfiguration) InvalidInput error = NewMocError(moccodes.InvalidInput) InvalidType error = NewMocError(moccodes.InvalidType) NotSupported error = NewMocError(moccodes.NotSupported) AlreadyExists error = NewMocError(moccodes.AlreadyExists) InUse error = NewMocError(moccodes.InUse) Duplicates error = NewMocError(moccodes.Duplicates) InvalidFilter error = NewMocError(moccodes.InvalidFilter) Failed error = NewMocError(moccodes.Failed) InvalidGroup error = NewMocError(moccodes.InvalidGroup) InvalidVersion error = NewMocError(moccodes.InvalidVersion) OldVersion error = NewMocError(moccodes.OldVersion) OutOfCapacity error = NewMocError(moccodes.OutOfCapacity) OutOfNodeCapacity error = NewMocError(moccodes.OutOfNodeCapacity) OutOfMemory error = NewMocError(moccodes.OutOfMemory) UpdateFailed error = NewMocError(moccodes.UpdateFailed) NotInitialized error = NewMocError(moccodes.NotInitialized) NotImplemented error = NewMocError(moccodes.NotImplemented) OutOfRange error = NewMocError(moccodes.OutOfRange) AlreadySet error = NewMocError(moccodes.AlreadySet) NotSet error = NewMocError(moccodes.NotSet) InconsistentState error = NewMocError(moccodes.InconsistentState) PendingState error = NewMocError(moccodes.PendingState) WrongHost error = NewMocError(moccodes.WrongHost) PoolFull error = NewMocError(moccodes.PoolFull) NoActionTaken error = NewMocError(moccodes.NoActionTaken) Expired error = NewMocError(moccodes.Expired) Revoked error = NewMocError(moccodes.Revoked) Timeout error = NewMocError(moccodes.Timeout) RunCommandFailed error = NewMocError(moccodes.RunCommandFailed) InvalidToken error = NewMocError(moccodes.InvalidToken) Unknown error = NewMocError(moccodes.Unknown) DeleteFailed error = NewMocError(moccodes.DeleteFailed) DeletePending error = NewMocError(moccodes.DeletePending) FileNotFound error = NewMocError(moccodes.FileNotFound) PathNotFound error = NewMocError(moccodes.PathNotFound) NotEnoughSpace error = NewMocError(moccodes.NotEnoughSpace) AccessDenied error = NewMocError(moccodes.AccessDenied) BlobNotFound error = NewMocError(moccodes.BlobNotFound) GenericFailure error = NewMocError(moccodes.GenericFailure) NoAuthenticationInformation error = NewMocError(moccodes.NoAuthenticationInformation) MeasurementUnitError error = NewMocError(moccodes.MeasurementUnitError) QuotaViolation error = NewMocError(moccodes.QuotaViolation) IPOutOfRange error = NewMocError(moccodes.IPOutOfRange) )
Functions ¶
func ErrorToProto ¶ added in v0.23.2
ErrorToProto converts an error to a protobuf common.Error by extracting the MocCode and message.
func GetErrorCode ¶ added in v0.10.8
func GetGRPCError ¶
GetGRPCError is used when returning errors from MOC GRPC services. It adds the MocCode to the error status details.
func GetGRPCErrorCode ¶
func GetMocErrorCode ¶ added in v0.23.2
GetMocErrorCode attempts to extract the MocCode from the given error. If the error is a multierr, it will return the MocCode if all errors in the multierr match the same MocCode. Otherwise, it returns MocCode.Unknown.
GetMocErrorCode follows the following rules when parsing individual errors:
- If the error is nil, it returns MocCode.OK.
- If the error is of type MocError, it returns the MocCode.
- If the error has a Cause that is not nil and is of type MocError, it returns the MocCode of the Cause.
- If both the error and its Cause are not of type MocError, it returns MocCode.Unknown.
func IsAccessDenied ¶ added in v0.10.31
func IsAlreadyExists ¶
func IsAlreadySet ¶
func IsBlobNotFound ¶ added in v0.13.2
func IsDegraded ¶
func IsDeleteFailed ¶ added in v0.10.20
func IsDeletePending ¶ added in v0.10.20
func IsDuplicates ¶ added in v0.10.8
func IsErrDeadlineExceeded ¶ added in v0.10.15
func IsFileNotFound ¶ added in v0.10.31
func IsGRPCAborted ¶
func IsGRPCAlreadyExist ¶
func IsGRPCDeadlineExceeded ¶
func IsGRPCNotFound ¶
func IsGRPCUnavailable ¶
func IsGRPCUnknown ¶
func IsGenericFailure ¶ added in v0.13.2
func IsIPOutOfRange ¶ added in v0.13.2
func IsInconsistentState ¶
func IsInvalidConfiguration ¶
func IsInvalidFilter ¶ added in v0.10.8
func IsInvalidGroup ¶
func IsInvalidInput ¶
func IsInvalidToken ¶ added in v0.10.14
func IsInvalidType ¶ added in v0.10.28
func IsInvalidVersion ¶
func IsMeasurementUnitError ¶ added in v0.13.2
func IsMocErrorCode ¶ added in v0.23.2
IsMocErrorCode wraps a call to GetMocErrorCode. It returns true only if the error has the same MocCode as the given code (no string matching).
func IsNoActionTaken ¶
func IsNoAuthenticationInformation ¶ added in v0.13.2
func IsNotEnoughSpace ¶ added in v0.10.31
func IsNotFound ¶
func IsNotImplemented ¶ added in v0.10.8
func IsNotInitialized ¶
func IsNotSupported ¶
func IsOldVersion ¶ added in v0.10.8
func IsOutOfCapacity ¶ added in v0.10.7
func IsOutOfMemory ¶
func IsOutOfNodeCapacity ¶ added in v0.10.28
func IsOutOfRange ¶
func IsPathNotFound ¶ added in v0.10.31
func IsPendingState ¶
func IsPoolFull ¶
func IsQuotaViolation ¶ added in v0.13.2
func IsRunCommandFailed ¶ added in v0.10.28
func IsUpdateFailed ¶ added in v0.10.8
func IsWrongHost ¶
func NewMocError ¶ added in v0.23.2
NewMocError creates a new MocError based on the given MocCode and message. If code is OK, it will return nil.
func ParseGRPCError ¶ added in v0.23.2
ParseGRPCError is when parsing errors from MOC GRPC services. Will extract the error as a MocError if GRPC code is Unknown.
func ProtoToMocError ¶ added in v0.23.2
ProtoToMocError converts a protobuf common.Error to a MocError.
Types ¶
type MocError ¶ added in v0.23.2
type MocError struct {
// contains filtered or unexported fields
}
MocError is an implementation of error that wraps a MocCode and an error message.
func (*MocError) GetMocCode ¶ added in v0.23.2
GetMocCode returns the underlying MocCode of the MocError.