errors

package
v3.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationFinished        = OperationStatus(1 << iota >> 1)
	OperationStatusUndefined // may be true or may be false
	OperationNotFinished
)

Binary flags that used as OperationStatus

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")

	// ErrAlreadyCommited returns if transaction Commit called twice
	ErrAlreadyCommited = errors.New("already committed")
)
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 NewWithIssues added in v3.5.2

func NewWithIssues(text string, issues ...error) error

NewWithIssues returns error which contains child issues

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) Code added in v3.4.2

func (e *OpError) Code() int32

func (*OpError) Error

func (e *OpError) Error() string

func (*OpError) Issues

func (e *OpError) Issues() IssueIterator

func (*OpError) Name added in v3.4.2

func (e *OpError) Name() string

type OperationStatus added in v3.7.0

type OperationStatus uint8

OperationStatus reports which status of operation: completed or none

func (OperationStatus) String added in v3.7.0

func (t OperationStatus) String() string

type RetryType

type RetryType uint8

RetryType reports which operations need to retry

type RetryableError added in v3.7.0

type RetryableError struct {
	Err               error
	BackoffType       BackoffType
	MustDeleteSession bool
}

func (*RetryableError) Error added in v3.7.0

func (e *RetryableError) Error() string

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) OperationStatus added in v3.7.0

func (e StatusCode) OperationStatus() OperationStatus

func (StatusCode) String

func (e StatusCode) String() string

type TransportError

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

func (*TransportError) Code added in v3.4.2

func (t *TransportError) Code() int32

func (*TransportError) Error

func (t *TransportError) Error() string

func (*TransportError) Name added in v3.4.2

func (t *TransportError) Name() 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) OperationStatus added in v3.7.0

func (t TransportErrorCode) OperationStatus() OperationStatus

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