errors

package
v3.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationCompletedTrue      = OperationCompleted(1 << iota >> 1)
	OperationCompletedUndefined // may be true or may be false
	OperationCompletedFalse
)

Binary flags that used as OperationCompleted

View Source
const (
	StatusUnknownStatus      = StatusCode(Ydb.StatusIds_STATUS_CODE_UNSPECIFIED)
	StatusBadRequest         = StatusCode(Ydb.StatusIds_BAD_REQUEST)
	StatusUnauthorized       = StatusCode(Ydb.StatusIds_UNAUTHORIZED)
	StatusInternalError      = StatusCode(Ydb.StatusIds_INTERNAL_ERROR)
	StatusAborted            = StatusCode(Ydb.StatusIds_ABORTED)
	StatusUnavailable        = StatusCode(Ydb.StatusIds_UNAVAILABLE)
	StatusOverloaded         = StatusCode(Ydb.StatusIds_OVERLOADED)
	StatusSchemeError        = StatusCode(Ydb.StatusIds_SCHEME_ERROR)
	StatusGenericError       = StatusCode(Ydb.StatusIds_GENERIC_ERROR)
	StatusTimeout            = StatusCode(Ydb.StatusIds_TIMEOUT)
	StatusBadSession         = StatusCode(Ydb.StatusIds_BAD_SESSION)
	StatusPreconditionFailed = StatusCode(Ydb.StatusIds_PRECONDITION_FAILED)
	StatusAlreadyExists      = StatusCode(Ydb.StatusIds_ALREADY_EXISTS)
	StatusNotFound           = StatusCode(Ydb.StatusIds_NOT_FOUND)
	StatusSessionExpired     = StatusCode(Ydb.StatusIds_SESSION_EXPIRED)
	StatusCancelled          = StatusCode(Ydb.StatusIds_CANCELLED)
	StatusUndetermined       = StatusCode(Ydb.StatusIds_UNDETERMINED)
	StatusUnsupported        = StatusCode(Ydb.StatusIds_UNSUPPORTED)
	StatusSessionBusy        = StatusCode(Ydb.StatusIds_SESSION_BUSY)
)

Errors describing unsusccessful operation status.

Variables

View Source
var (
	// ErrClosed is returned when operation requested on a closed driver.
	ErrClosed = errors.New("driver closed")

	// ErrNilConnection is returned when use nil preferred connection
	ErrNilConnection = errors.New("nil connection")
)
View Source
var ErrOperationNotReady = errors.New("operation is not ready yet")

Functions

func As

func As(err error, target interface{}) bool

As is a proxy to errors.As This need to single import errors

func ErrIf

func ErrIf(cond bool, err error) error

func HideEOF

func HideEOF(err error) error

func Is

func Is(err, target error) bool

Is is a proxy to errors.Is This need to single import errors

func IsOpError

func IsOpError(err error, code StatusCode) bool

IsOpError reports whether err is OpError with given code as the Reason.

func IsTimeoutError

func IsTimeoutError(err error) bool

func IsTransportError

func IsTransportError(err error, code TransportErrorCode) bool

IsTransportError reports whether err is TransportError with given code as the Reason.

func MapGRPCError

func MapGRPCError(err error) error

func MustPessimizeEndpoint

func MustPessimizeEndpoint(err error) bool

func New

func New(text string) error

New is a proxy to errors.New This need to single import errors

func NewOpError

func NewOpError(opts ...oeOpt) error

func NewTransportError

func NewTransportError(opts ...teOpt) error

NewTransportError returns a new transport error with given options

func WithOEIssues

func WithOEIssues(issues []*Ydb_Issue.IssueMessage) oeOpt

WithOEIssues is an option for construct operation error with issues list WithOEIssues must use as `NewOpError(WithOEIssues(issues))`

func WithOEOperation

func WithOEOperation(operation operation) oeOpt

WithOEOperation is an option for construct operation error from operation WithOEOperation must use as `NewOpError(WithOEOperation(operation))`

func WithOEReason

func WithOEReason(reason StatusCode) oeOpt

WithOEReason is an option for construct operation error with reason code WithOEReason must use as `NewOpError(WithOEReason(reason))`

func WithTEError

func WithTEError(err error) teOpt

WithTEError stores err into transport error

func WithTEMessage

func WithTEMessage(message string) teOpt

WithTEMessage stores message into transport error

func WithTEOperation

func WithTEOperation(operation operation) teOpt

WithTEOperation stores reason code into transport error from operation

func WithTEReason

func WithTEReason(reason TransportErrorCode) teOpt

Types

type BackoffType

type BackoffType uint8

BackoffType reports how to Backoff operation

const (
	BackoffTypeNoBackoff BackoffType = 1 << iota >> 1

	BackoffTypeFastBackoff
	BackoffTypeSlowBackoff

	BackoffTypeBackoffAny = BackoffTypeFastBackoff | BackoffTypeSlowBackoff
)

Binary flags that used as BackoffType

func (BackoffType) String

func (b BackoffType) String() string

type Issue

type Issue struct {
	Message  string
	Code     uint32
	Severity uint32
}

Issue struct

type IssueIterator

type IssueIterator []*Ydb_Issue.IssueMessage

func (IssueIterator) Get

func (it IssueIterator) Get(i int) (issue Issue, nested IssueIterator)

func (IssueIterator) Len

func (it IssueIterator) Len() int

type OpError

type OpError struct {
	Reason StatusCode
	// contains filtered or unexported fields
}

OpError reports about operation fail.

func (*OpError) Error

func (e *OpError) Error() string

func (*OpError) Issues

func (e *OpError) Issues() IssueIterator

type OperationCompleted

type OperationCompleted uint8

OperationCompleted reports which status of operation: completed or none

func (OperationCompleted) String

func (t OperationCompleted) String() string

type RetryType

type RetryType uint8

RetryType reports which operations need to retry

type StatusCode

type StatusCode int32

StatusCode reports unsuccessful operation status code.

func (StatusCode) BackoffType

func (e StatusCode) BackoffType() BackoffType

func (StatusCode) MustDeleteSession

func (e StatusCode) MustDeleteSession() bool

func (StatusCode) OperationCompleted

func (e StatusCode) OperationCompleted() OperationCompleted

func (StatusCode) String

func (e StatusCode) String() string

type TransportError

type TransportError struct {
	Reason TransportErrorCode
	// contains filtered or unexported fields
}

func (*TransportError) Error

func (t *TransportError) Error() string

func (*TransportError) Unwrap

func (t *TransportError) Unwrap() error

type TransportErrorCode

type TransportErrorCode int32
const (
	TransportErrorUnknownCode TransportErrorCode = iota
	TransportErrorCanceled
	TransportErrorUnknown
	TransportErrorInvalidArgument
	TransportErrorDeadlineExceeded
	TransportErrorNotFound
	TransportErrorAlreadyExists
	TransportErrorPermissionDenied
	TransportErrorResourceExhausted
	TransportErrorFailedPrecondition
	TransportErrorAborted
	TransportErrorOutOfRange
	TransportErrorUnimplemented
	TransportErrorInternal
	TransportErrorUnavailable
	TransportErrorDataLoss
	TransportErrorUnauthenticated
)

func (TransportErrorCode) BackoffType

func (t TransportErrorCode) BackoffType() BackoffType

func (TransportErrorCode) MustDeleteSession

func (t TransportErrorCode) MustDeleteSession() bool

func (TransportErrorCode) OperationCompleted

func (t TransportErrorCode) OperationCompleted() OperationCompleted

func (TransportErrorCode) String

func (t TransportErrorCode) String() string

Jump to

Keyboard shortcuts

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