跳到主要内容

MixedVersionedCacheTransactionError

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/versioned-domain.ts:236

tracked 与 untracked 实体混进了同一个事务单元

Remarks​

继承既有的 RxDBMixedVersionedCacheTransactionError 而不是另起一个类:spec.md 指定 承载者就是它,既有的 catch 分支与 instanceof 判断因此继续命中,cacheEntities / versionedEntities 两个数组照常可读。这里加的是流式守卫才知道的东西——撞上的是哪两个 实体。父类的数组形态服务于「整批扫一遍再报」的批量路径,那条路径上没有「第几次操作撞的」 这个概念。

抛出即回滚整个事务:两者写语义不可调和(版本化实体写本地并进 changelog,QueryCache 实体 先写远端再落可丢弃缓存),同批只会得到「一半进了变更历史、一半没有」。回滚由适配器保证 (throw ⇒ rollback),不由本类负责。

Extends​

Constructors​

Constructor​

new MixedVersionedCacheTransactionError(trackedEntityName, untrackedEntityName): MixedVersionedCacheTransactionError;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/versioned-domain.ts:245

只由 createTransactionGuard() 在第二类实体刚出现的那一刻构造。

Parameters​

ParameterTypeDescription
trackedEntityNamestring本事务内先后撞上的 tracked 实体名
untrackedEntityNamestring本事务内先后撞上的 untracked 实体名

Returns​

MixedVersionedCacheTransactionError

Remarks​

两个参数取的是各自先撞上的那一个,不是全集(理由见 createTransactionGuard)。 转交父类时各自包成单元素数组:父类那两个数组的形状服务于「整批扫一遍再报」的批量路径, 而流式守卫这边根本没有全集可交。

Overrides​

RxDBMixedVersionedCacheTransactionError.constructor

Properties​

cacheEntities​

readonly cacheEntities: readonly string[];

Defined in: packages/rxdb/dist/RxDBError.d.ts:192

本批中走 QueryCache 的实体名

Inherited from​

RxDBMixedVersionedCacheTransactionError.cacheEntities


cause?​

optional cause?: unknown;

Defined in: node_modules/.pnpm/typescript@6.0.3_patch_hash=ef3c2292deb88eb14130359d5acc1febc0226af46b7b945db6c7250c6cb4efbb/node_modules/typescript/lib/lib.es2022.error.d.ts:24

Inherited from​

RxDBMixedVersionedCacheTransactionError.cause


code​

readonly code: "mixed_versioned_cache_transaction" = "mixed_versioned_cache_transaction";

Defined in: packages/rxdb/dist/RxDBError.d.ts:196

US-306 FR-046 指定的稳定错误码;写字面量而非取自码表的理由见本类

Remarks​

Inherited from​

RxDBMixedVersionedCacheTransactionError.code


message​

message: string;

Defined in: node_modules/.pnpm/typescript@6.0.3_patch_hash=ef3c2292deb88eb14130359d5acc1febc0226af46b7b945db6c7250c6cb4efbb/node_modules/typescript/lib/lib.es5.d.ts:1075

Inherited from​

RxDBMixedVersionedCacheTransactionError.message


name​

name: string;

Defined in: node_modules/.pnpm/typescript@6.0.3_patch_hash=ef3c2292deb88eb14130359d5acc1febc0226af46b7b945db6c7250c6cb4efbb/node_modules/typescript/lib/lib.es5.d.ts:1074

Inherited from​

RxDBMixedVersionedCacheTransactionError.name


stack?​

optional stack?: string;

Defined in: node_modules/.pnpm/typescript@6.0.3_patch_hash=ef3c2292deb88eb14130359d5acc1febc0226af46b7b945db6c7250c6cb4efbb/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from​

RxDBMixedVersionedCacheTransactionError.stack


trackedEntityName​

readonly trackedEntityName: string;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/versioned-domain.ts:247

本事务内先后撞上的 tracked 实体名


untrackedEntityName​

readonly untrackedEntityName: string;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/versioned-domain.ts:249

本事务内先后撞上的 untracked 实体名


versionedEntities​

readonly versionedEntities: readonly string[];

Defined in: packages/rxdb/dist/RxDBError.d.ts:194

本批中走版本化同步的实体名

Inherited from​

RxDBMixedVersionedCacheTransactionError.versionedEntities


stackTraceLimit​

static stackTraceLimit: number;

Defined in: node_modules/.pnpm/@types+node@26.6.3/node_modules/@types/node/globals.d.ts:67

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from​

RxDBMixedVersionedCacheTransactionError.stackTraceLimit

Methods​

captureStackTrace()​

static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@26.6.3/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
b();
}

function b() {
c();
}

function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;

// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}

a();

Parameters​

ParameterType
targetObjectobject
constructorOpt?Function

Returns​

void

Inherited from​

RxDBMixedVersionedCacheTransactionError.captureStackTrace


prepareStackTrace()​

static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@26.6.3/node_modules/@types/node/globals.d.ts:55

Parameters​

ParameterType
errError
stackTracesCallSite[]

Returns​

any

See​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from​

RxDBMixedVersionedCacheTransactionError.prepareStackTrace