xerrors

package
v3.89.5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeUndefined = Type(iota)
	TypeNoError
	TypeNonRetryable
	TypeConditionallyRetryable
	TypeRetryable
)

Variables

This section is empty.

Functions

func As

func As(err error, targets ...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 FromOperation

func FromOperation(operation operation.Status) *operationOption

FromOperation is an option for construct operation error from operation.Status FromOperation must use as `Operation(FromOperation(operation.Status))`

func HideEOF

func HideEOF(err error) error

func InvalidObject added in v3.59.0

func InvalidObject() invalidObjectOption

func Is

func Is(err error, targets ...error) bool

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

func IsContextError added in v3.59.0

func IsContextError(err error) bool

func IsErrorFromServer added in v3.55.3

func IsErrorFromServer(err error) bool

IsErrorFromServer return true if err returned from server (opposite to raised internally in sdk)

func IsOperationError

func IsOperationError(err error, codes ...Ydb.StatusIds_StatusCode) bool

IsOperationError reports whether err is operationError with given errType codes.

func IsOperationErrorTransactionLocksInvalidated added in v3.48.4

func IsOperationErrorTransactionLocksInvalidated(err error) (isTLI bool)

func IsRetryObjectValid added in v3.59.0

func IsRetryObjectValid(err error) bool

func IsRetryableError added in v3.79.1

func IsRetryableError(err error) bool

func IsTimeoutError

func IsTimeoutError(err error) bool

func IsTransportError

func IsTransportError(err error, codes ...grpcCodes.Code) bool

IsTransportError reports whether err is transportError with given grpc codes

func IsYdb

func IsYdb(err error) bool

func IterateByIssues

func IterateByIssues(err error, it func(message string, code Ydb.StatusIds_StatusCode, severity uint32))

func Join added in v3.52.0

func Join(errs ...error) error

func NewWithIssues

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

NewWithIssues returns error which contains child issues

func Operation

func Operation(opts ...oeOpt) error

func Retryable added in v3.21.0

func Retryable(err error, opts ...RetryableErrorOption) error

func Transport

func Transport(err error, opts ...teOpt) error

Transport returns a new transport error with given options

func Unretryable added in v3.76.2

func Unretryable(err error) unretryableError

func WithAddress

func WithAddress(address string) addressOption

func WithBackoff

func WithBackoff(t backoff.Type) backoffOption

func WithIssues

func WithIssues(issues []*Ydb_Issue.IssueMessage) issuesOption

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

func WithName added in v3.21.0

func WithName(name string) nameOption

func WithNodeID added in v3.75.1

func WithNodeID(nodeID uint32) nodeIDOption

func WithSkipDepth

func WithSkipDepth(skipDepth int) withStackTraceOption

func WithStackTrace

func WithStackTrace(err error, opts ...withStackTraceOption) error

WithStackTrace is a wrapper over original err with file:line identification

func WithStatusCode

func WithStatusCode(code Ydb.StatusIds_StatusCode) statusCodeOption

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

func WithTraceID added in v3.52.0

func WithTraceID(traceID string) traceIDOption

WithTraceID is an option for construct operation error with traceID

func Wrap

func Wrap(err error) error

Wrap makes internal ydb error

Types

type Error

type Error interface {
	error

	Code() int32
	Name() string
	Type() Type
	BackoffType() backoff.Type
	IsRetryObjectValid() bool
}

Error is an interface of error which reports about error code and error name.

func OperationError

func OperationError(err error) Error

func RetryableError

func RetryableError(err error) Error

RetryableError return Error if err is retriable error, else nil

func TransportError

func TransportError(err error) Error

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 RetryableErrorOption

type RetryableErrorOption interface {
	// contains filtered or unexported methods
}

type Type added in v3.42.0

type Type uint8

Type reports which error type

func Check

func Check(err error) (
	code int64,
	errType Type,
	backoffType backoff.Type,
	invalidObject bool,
)

Check returns retry mode for err.

func (Type) String added in v3.42.0

func (t Type) String() string

Jump to

Keyboard shortcuts

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