Documentation ¶
Index ¶
- Constants
- Variables
- func As(err error, target interface{}) bool
- func ErrIf(cond bool, err error) error
- func HideEOF(err error) error
- func Is(err, target error) bool
- func IsOpError(err error, code StatusCode) bool
- func IsTimeoutError(err error) bool
- func IsTransportError(err error, code TransportErrorCode) bool
- func MapGRPCError(err error) 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 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 OpError
- 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 ¶
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") )
var ErrOperationNotReady = errors.New("operation is not ready yet")
Functions ¶
func IsOpError ¶
func IsOpError(err error, code StatusCode) bool
IsOpError reports whether err is OpError with given code as the Reason.
func IsTimeoutError ¶
func IsTransportError ¶
func IsTransportError(err error, code 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 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 OpError ¶
type OpError struct { Reason StatusCode // contains filtered or unexported fields }
OpError reports about operation fail.
func (*OpError) Issues ¶
func (e *OpError) Issues() IssueIterator
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 (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 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