xerrors

package
v3.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, targets ...interface{}) (ok bool)

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

func ErrIf

func ErrIf(cond bool, err error) error

func FromGRPCError

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

func FromOperation

func FromOperation(operation operationStatus) oeOpt

FromOperation is an option for construct operationStatus error from operationStatus FromOperation must use as `Operation(FromOperation(operationStatus))`

func HideEOF

func HideEOF(err error) error

func Is

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

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

func IsOperationError

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

IsOperationError reports whether err is operationError with given status codes.

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 MustPessimizeEndpoint

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

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(opts ...teOpt) error

Transport returns a new transport error with given options

func WithAddress

func WithAddress(address string) teOpt

func WithCode

func WithCode(code grpcCodes.Code) teOpt

func WithIssues

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

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

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

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

func Wrap

func Wrap(err error) error

Wrap makes internal ydb error

Types

type Error

type Error interface {
	error

	Code() int32
	Name() string
	OperationStatus() operation.Status
	BackoffType() backoff.Type
	MustDeleteSession() 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

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 func(e *retryableError)

func WithBackoff

func WithBackoff(t backoff.Type) RetryableErrorOption

func WithDeleteSession

func WithDeleteSession() RetryableErrorOption

func WithName added in v3.21.0

func WithName(name string) RetryableErrorOption

Jump to

Keyboard shortcuts

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