Documentation ¶
Index ¶
- Constants
- func As(err error, targets ...interface{}) bool
- func ErrIf(cond bool, err error) error
- func HideEOF(err error) error
- func Is(err error, targets ...error) bool
- func IsOpError(err error, codes ...StatusCode) bool
- func IsTimeoutError(err error) bool
- func IsTransportError(err error, codes ...TransportErrorCode) bool
- func IsYdb(err error) (ok bool)
- func MapGRPCError(err error, opts ...teOpt) error
- func MustPessimizeEndpoint(err error) bool
- func New(text string) error
- func NewOpError(opts ...oeOpt) error
- func NewTransportError(opts ...teOpt) error
- func NewWithIssues(text string, issues ...error) error
- func WithOEIssues(issues []*Ydb_Issue.IssueMessage) oeOpt
- func WithOEOperation(operation operation) oeOpt
- func WithOEReason(reason StatusCode) oeOpt
- func WithSkipDepth(skipDepth int) withStackTraceOption
- func WithStackTrace(err error, opts ...withStackTraceOption) error
- func WithTEAddress(address string) teOpt
- func WithTEError(err error) teOpt
- func WithTEMessage(message string) teOpt
- func WithTEOperation(operation operation) teOpt
- func WithTEReason(reason TransportErrorCode) teOpt
- type BackoffType
- type Issue
- type IssueIterator
- type OperationError
- type OperationStatus
- type RetryType
- type RetryableError
- type StatusCode
- type TransportError
- type TransportErrorCode
Constants ¶
const ( OperationFinished = OperationStatus(1 << iota >> 1) OperationStatusUndefined // may be true or may be false OperationNotFinished )
Binary flags that used as OperationStatus
const ( StatusUnknownStatus = StatusCode(Ydb.StatusIds_STATUS_CODE_UNSPECIFIED) StatusBadRequest = StatusCode(Ydb.StatusIds_BAD_REQUEST) StatusInternalError = StatusCode(Ydb.StatusIds_INTERNAL_ERROR) StatusAborted = StatusCode(Ydb.StatusIds_ABORTED) 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 ¶
This section is empty.
Functions ¶
func IsOpError ¶
func IsOpError(err error, codes ...StatusCode) bool
IsOpError reports whether err is OperationError with given code as the Reason.
func IsTimeoutError ¶
func IsTransportError ¶
func IsTransportError(err error, codes ...TransportErrorCode) bool
IsTransportError reports whether err is TransportError with given code as the Reason.
func MapGRPCError ¶
func MustPessimizeEndpoint ¶
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
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 WithSkipDepth ¶ added in v3.15.0
func WithSkipDepth(skipDepth int) withStackTraceOption
func WithStackTrace ¶ added in v3.15.0
WithStackTrace is a wrapper over original err with file:line identification
func WithTEAddress ¶ added in v3.15.0
func WithTEAddress(address string) teOpt
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 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 OperationError ¶ added in v3.15.0
type OperationError struct { Reason StatusCode // contains filtered or unexported fields }
OperationError reports about operation fail.
func (*OperationError) Code ¶ added in v3.15.0
func (e *OperationError) Code() int32
func (*OperationError) Error ¶ added in v3.15.0
func (e *OperationError) Error() string
func (*OperationError) Issues ¶ added in v3.15.0
func (e *OperationError) Issues() []*Ydb_Issue.IssueMessage
func (*OperationError) Name ¶ added in v3.15.0
func (e *OperationError) 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 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 (e *TransportError) Code() int32
func (*TransportError) Error ¶
func (e *TransportError) Error() string
func (*TransportError) Name ¶ added in v3.4.2
func (e *TransportError) Name() string
func (*TransportError) Unwrap ¶
func (e *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 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