Documentation ¶
Index ¶
- Variables
- func Annotatef(err error, format string, args ...interface{}) error
- func CASError(e error, oldCode int32, newErr error) error
- func CASError2(e error, exp error, newErr error) error
- func CASErrorCode(e error, oldCode, newCode int32)
- func Cause(err error) error
- func Equal(err1, err2 error) bool
- func Errorf(format string, v ...interface{}) error
- func GetErrorCode(e error) int32
- func IsErrType(err error, code int32) bool
- func IsMustRollbackCommitErr(e error) bool
- func IsMustRollbackGetErr(e error) bool
- func IsMustRollbackWriteKeyErr(e error) bool
- func IsNotExistsErr(e error) bool
- func IsNotSupportedErr(e error) bool
- func IsQueueFullErr(e error) bool
- func IsRetryableGetErr(e error) bool
- func IsRetryableTabletGetErr(err error) bool
- func IsRetryableTransactionErr(e error) bool
- func IsRetryableTransactionManagerErr(e error) bool
- func IsSnapshotReadTabletErr(err error) bool
- func New(s string) error
- func NewErrorFromPB(x *commonpb.Error) error
- func NotEqual(err1, err2 error) bool
- func ReplaceErr(original, replacement error) error
- func SetErrorCode(e error, code int32)
- func Stack(err error) trace.Stack
- func ToPBError(e error) *commonpb.Error
- func Trace(err error) error
- func Wrap(err, other error) error
- type Error
- type ErrorKey
- type SubCodeGenerator
- type TracedError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AssertIsErr = func(assert *testifyassert.Assertions, err error, exp *Error) bool { return assert.IsTypef(&Error{}, err, "expect type *errors.Error, but got %T(%v)", err, err) && assert.Equal(exp.Code, GetErrorCode(err)) } AssertIsKeyOrVersionNotExistsErr = func(assert *testifyassert.Assertions, err error) bool { return AssertIsErr(assert, err, ErrKeyOrVersionNotExist) } AssertNilOrErr = func(assert *testifyassert.Assertions, err error, exp *Error) bool { if err == nil { return true } return AssertIsErr(assert, err, exp) } )
View Source
var ( ErrWriteReadConflictSubCodeGenerator = NewSubCodeGenerator() ErrWriteReadConflict = registerErr(&Error{ Code: consts.ErrCodeWriteReadConflict, SubCode: ErrWriteReadConflictSubCodeGenerator.Next(), Msg: "write read conflict", }) ErrWriteReadConflictReaderSkippedCommittedData = registerErr(&Error{ Code: consts.ErrCodeWriteReadConflict, SubCode: ErrWriteReadConflictSubCodeGenerator.Next(), Msg: "write read conflict: reader skipped committed data", }) ErrWriteReadConflictUnsafeRead = registerErr(&Error{ Code: consts.ErrCodeWriteReadConflict, SubCode: ErrWriteReadConflictSubCodeGenerator.Next(), Msg: "write read conflict: unsafe read", }) ErrWriteReadConflictUnsafeReadWaitTxnTerminateFailed = registerErr(&Error{ Code: consts.ErrCodeWriteReadConflict, SubCode: ErrWriteReadConflictSubCodeGenerator.Next(), Msg: "write read conflict: unsafe read wait txn terminate failed", }) ErrWriteReadConflictFutureWritePrevented = registerErr(&Error{ Code: consts.ErrCodeWriteReadConflict, SubCode: ErrWriteReadConflictSubCodeGenerator.Next(), Msg: "write read conflict: future write prevented", }) ErrStaleWriteSubCodeGenerator = NewSubCodeGenerator() ErrStaleWrite = registerErr(&Error{ Code: consts.ErrCodeStaleWrite, SubCode: ErrStaleWriteSubCodeGenerator.Next(), Msg: "stale write", }) ErrStaleWriteWriterVersionSmallerThanMaxRemovedWriterVersion = registerErr(&Error{ Code: consts.ErrCodeStaleWrite, SubCode: ErrStaleWriteSubCodeGenerator.Next(), Msg: "stale write: writer version smaller than max removed", }) ErrStaleWriteInsertTooOldTxn = registerErr(&Error{ Code: consts.ErrCodeStaleWrite, SubCode: ErrStaleWriteSubCodeGenerator.Next(), Msg: "stale write: insert too old txn", }) ErrReadUncommittedDataPrevTxnStatusUndetermined = registerErr(&Error{ Code: consts.ErrCodeReadUncommittedDataPrevTxnStateUndetermined, Msg: "read uncommitted data previous txn state undetermined", }) ErrReadUncommittedDataPrevTxnKeyRollbacked = registerErr(&Error{ Code: consts.ErrCodeReadUncommittedDataPrevTxnKeyRollbacked, Msg: "read uncommitted data previous txn key has been rollbacked", }) ErrReadUncommittedDataPrevTxnKeyRollbackedReadAfterWrite = registerErr(&Error{ Code: consts.ErrCodeReadUncommittedDataPrevTxnKeyRollbacked, SubCode: 1, Msg: "read uncommitted data previous txn key has been rollbacked: read after write", }) ErrReadUncommittedDataPrevTxnToBeRollbacked = registerErr(&Error{ Code: consts.ErrCodeReadUncommittedDataPrevTxnToBeRollbacked, Msg: "read uncommitted data previous txn to be rollbacked", }) ErrReadAfterWriteFailed = registerErr(&Error{ Code: consts.ErrCodeReadAfterWriteFailed, Msg: "read after write failed", }) ErrTxnRollbacking = registerErr(&Error{ Code: consts.ErrCodeTxnRollbacking, Msg: "txn rollbacking", }) ErrTxnRollbacked = registerErr(&Error{ Code: consts.ErrCodeTxnRollbacked, Msg: "txn rollbacked", }) ErrShardsNotReady = registerErr(&Error{ Code: consts.ErrCodeShardsNotReady, Msg: "shards not ready", }) ErrKeyOrVersionNotExist = registerErr(&Error{ Code: consts.ErrCodeKeyOrVersionNotExists, Msg: "key or version not exist", }) ErrVersionAlreadyExists = registerErr(&Error{ Code: consts.ErrCodeVersionAlreadyExists, Msg: "version already exists", }) ErrNotSupported = registerErr(&Error{ Code: consts.ErrCodeNotSupported, Msg: "not supported", }) ErrNotAllowed = registerErr(&Error{ Code: consts.ErrCodeNotAllowed, Msg: "not allowed", }) ErrInvalidRequest = registerErr(&Error{ Code: consts.ErrCodeInvalidRequest, Msg: "invalid request", }) ErrTxnExists = registerErr(&Error{ Code: consts.ErrCodeTransactionAlreadyExists, Msg: "transaction already exists", }) ErrTransactionNotFound = registerErr(&Error{ Code: consts.ErrCodeTransactionNotFound, Msg: "transaction not found", }) ErrTransactionStateCorrupted = registerErr(&Error{ Code: consts.ErrCodeTransactionStateCorrupted, Msg: "transaction state corrupted", }) ErrTransactionInternalVersionOverflow = registerErr(&Error{ Code: consts.ErrCodeTransactionInternalVersionOverflow, Msg: fmt.Sprintf("transaction internal version overflows %d", consts.MaxTxnInternalVersion), }) ErrNilResponse = registerErr(&Error{ Code: consts.ErrCodeNilResponse, Msg: "response is nil", }) ErrInvalidResponse = registerErr(&Error{ Code: consts.ErrCodeInvalidResponse, Msg: "response is invalid", }) ErrTxnRetriedTooManyTimes = registerErr(&Error{ Code: consts.ErrCodeTxnRetriedTooManyTimes, Msg: "transaction retried too many times", }) ErrInject = registerErr(&Error{ Code: consts.ErrCodeInject, Msg: "injected error", }) ErrDummy = registerErr(&Error{ Code: consts.ErrCodeDummy, Msg: "dummy error", }) ErrAssertFailed = registerErr(&Error{ Code: consts.ErrCodeAssertFailed, Msg: "assert failed", }) ErrSchedulerClosed = registerErr(&Error{ Code: consts.ErrCodeSchedulerClosed, Msg: "scheduler closed", }) ErrEmptyKey = registerErr(&Error{ Code: consts.ErrCodeEmptyKey, Msg: "key is empty", }) ErrEmptyKeys = registerErr(&Error{ Code: consts.ErrCodeEmptyKeys, Msg: "keys are empty", }) ErrDontUseThisBeforeTaskFinished = registerErr(&Error{ Code: consts.ErrCodeDontUseThisBeforeTaskFinished, Msg: "don't use this before task finish", }) ErrGoRoutineExited = registerErr(&Error{ Code: consts.ErrCodeGoRoutineExited, Msg: "go routine exited", }) ErrCantRemoveCommittedValue = registerErr(&Error{ Code: consts.ErrCodeCantRemoveCommittedValue, Msg: "can't remove committed value", }) ErrInvalidTopoData = registerErr(&Error{ Code: consts.ErrCodeInvalidTopoData, Msg: "invalid topo data", }) ErrCantGetOracle = registerErr(&Error{ Code: consts.ErrCodeCantGetOracle, Msg: "can't get oracle", }) ErrInvalidConfig = registerErr(&Error{ Code: consts.ErrCodeInvalidConfig, Msg: "invalid config", }) ErrReadModifyWriteTransactionCommitWithNoWrittenKeys = registerErr(&Error{ Code: consts.ErrCodeReadModifyWriteTransactionCommitWithNoWrittenKeys, Msg: "read modify write transaction commit with no written keys", }) ErrReadModifyWriteWaitFailed = registerErr(&Error{ Code: consts.ErrCodeReadModifyWriteWaitFailed, Msg: "read for write wait failed", }) ErrReadModifyWriteQueueFull = registerErr(&Error{ Code: consts.ErrCodeReadModifyWriteQueueFull, Msg: "read for write queue full, retry later", }) ErrReadModifyWriteReaderTimeouted = registerErr(&Error{ Code: consts.ErrCodeReadModifyWriteReaderTimeouted, Msg: "read for write reader timeouted", }) ErrTimestampCacheWriteQueueFull = registerErr(&Error{ Code: consts.ErrCodeTimestampCacheWriteQueueFull, Msg: "timestamp cache write queue full, retry later", }) ErrWriteIntentQueueFull = registerErr(&Error{ Code: consts.ErrCodeWriteIntentQueueFull, Msg: "write intent queue full, retry later", }) ErrWaitKeyEventFailed = registerErr(&Error{ Code: consts.ErrCodeWaitKeyEventFailed, Msg: "wait key event failed", }) ErrTabletWriteTransactionNotFound = registerErr(&Error{ Code: consts.ErrCodeTabletWriteTransactionNotFound, Msg: "tablet write transaction not found, probably removed", }) ErrTransactionRecordNotFoundAndWontBeWritten = registerErr(&Error{ Code: consts.ErrCodeTransactionRecordNotFoundAndWontBeWritten, Msg: "transaction record not found and prevented from being written", }) ErrTransactionRecordNotFoundAndFoundAbortedValue = registerErr(&Error{ Code: consts.ErrCodeTransactionRecordNotFoundAndFoundRollbackedValue, Msg: "transaction record not found and found aborted value", }) ErrTransactionRecordAborted = registerErr(&Error{ Code: consts.ErrCodeTransactionRecordAborted, Msg: "transaction record aborted", }) ErrPrevWriterNotFinishedYet = registerErr(&Error{ Code: consts.ErrCodePrevWriterNotFinishedYet, Msg: "prev writer not finished yet", }) ErrInternalVersionSmallerThanPrevWriter = registerErr(&Error{ Code: consts.ErrCodeInternalVersionSmallerThanPrevWriter, Msg: "internal version smaller than previous writer", }) ErrSnapshotReadRetriedTooManyTimes = registerErr(&Error{ Code: consts.ErrCodeSnapshotReadRetriedTooManyTimes, Msg: "snapshot read retried too many times", }) ErrMinAllowedSnapshotVersionViolated = registerErr(&Error{ Code: consts.ErrCodeMinAllowedSnapshotVersionViolated, Msg: "min allowed snapshot version violated", }) ErrInvalidTxnSnapshotReadOption = registerErr(&Error{ Code: consts.ErrCodeInvalidTxnSnapshotReadOption, Msg: "invalid TxnSnapshotReadOption", }) ErrWriteKeyAfterTabletTxnRollbacked = registerErr(&Error{ Code: consts.ErrCodeWriteKeyAfterTabletTxnRollbacked, Msg: "write key after tablet transaction rollbacked", }) ErrRemoveKeyFailed = registerErr(&Error{ Code: consts.ErrCodeRemoveKeyFailed, Msg: "remove key failed", }) )
View Source
var AllErrors = make(map[ErrorKey]*Error, 256)
View Source
var TraceEnabled = true
Functions ¶
func CASErrorCode ¶
func GetErrorCode ¶
func IsMustRollbackCommitErr ¶
func IsMustRollbackGetErr ¶
func IsNotExistsErr ¶
func IsNotSupportedErr ¶
func IsQueueFullErr ¶
func IsRetryableGetErr ¶
func IsRetryableTabletGetErr ¶
func IsSnapshotReadTabletErr ¶
func NewErrorFromPB ¶
func ReplaceErr ¶
func SetErrorCode ¶
Types ¶
type ErrorKey ¶
func GetErrorKey ¶
type SubCodeGenerator ¶
type SubCodeGenerator int32
func NewSubCodeGenerator ¶
func NewSubCodeGenerator() *SubCodeGenerator
func (*SubCodeGenerator) Next ¶
func (g *SubCodeGenerator) Next() int32
type TracedError ¶
func (*TracedError) Error ¶
func (e *TracedError) Error() string
Click to show internal directories.
Click to hide internal directories.