package errors

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/errors"

Index

Constants

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

Binary flags that used as OperationStatus

Functions

func As

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

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

func Check

func Check(err error) (
	statusCode int64,
	operationStatus OperationStatus,
	backoff BackoffType,
	deleteSession bool,
)

Check returns retry mode for err.

func ErrIf

func ErrIf(cond bool, err error) error

func FromGRPCError

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

func FromOperation

func FromOperation(operation operation) oeOpt

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

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) (ok 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 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

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

NewWithIssues returns error which contains child issues

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 operation error with issues list WithIssues must use as `NewOpError(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 operation error with reason code WithStatusCode must use as `NewOpError(WithStatusCode(reason))`

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 Error

type Error interface {
	error

	Code() int32
	Name() string
}

func OperationError

func OperationError(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 OperationStatus

type OperationStatus uint8

OperationStatus reports which status of operation: completed or none

func (OperationStatus) String

func (t OperationStatus) String() string

type RetryType

type RetryType uint8

RetryType reports which operations need to retry

type RetryableError

type RetryableError struct {
	Err               error
	BackoffType       BackoffType
	MustDeleteSession bool
}

func (*RetryableError) Error

func (e *RetryableError) Error() string

Source Files

check.go errors.go issues.go operation.go retry.go retryable.go stacktrace.go transport.go ydb.go

Version
v3.16.9
Published
Mar 23, 2022
Platform
js/wasm
Imports
12 packages
Last checked
14 minutes ago

Tools for package owners.