CommitEncryptedAtRestError
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:142
一个加密列的值没有以落库形态进入 commit(FR-038)。
Remarks
携带的全部是身份与位置:命名空间、实体名、实体主键、单元 id、列名、属性名、成因。
不带那个值本身——errorSurfaceOf 之类的诊断会把错误的自有属性整体序列化,
而这里被拒的值恰好有很大概率就是明文,带上它等于把明文写进日志。
实体主键可以带:@aiao/rxdb-adapter-encrypted 的 validateEncryptedPropertyMetadata
禁止把主键声明成加密列,所以 entityId 永远不是加密字段值。
没有对应的 CommitErrorCode:那张码表由 commit-error-codes.spec.ts 钉成
「恰好八条,不多不少」,而本错误是写入前的入参校验,不是调用方需要分支处理的库状态。
Extends
Constructors
Constructor
new CommitEncryptedAtRestError(
namespace,
entity,
entityId,
unitId,
column,
property,
reason
): CommitEncryptedAtRestError;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:152
只由本文件的 assertColumnEncryptedAtRest 在逐列扫描时构造。
Parameters
| Parameter | Type | Description |
|---|---|---|
namespace | string | 目标实体的命名空间 |
entity | string | 目标实体名 |
entityId | string | 目标实体主键 |
unitId | string | 命中处所属的变更单元 |
column | CommitPatchColumn | 命中处所在的列 |
property | string | 命中处的加密属性名 |
reason | CommitEncryptedAtRestReason | 见 CommitEncryptedAtRestReason |
Returns
CommitEncryptedAtRestError
Remarks
七项全部走参数属性,于是「错误的自有属性恰好是身份与位置、且只有身份与位置」这条不变量
在签名上就能核对完。想往错误里补上下文的人必须动这份签名,而不是在抛出点 Object.assign
一个字段上去——后者不产生任何编译错误,却足以让被拒的那个值(很可能正是明文)
随诊断序列化流出去,而不让它流出去正是本类存在的理由(见类注释)。
Overrides
Properties
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
column
readonly column: CommitPatchColumn;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:162
命中处所在的列
entity
readonly entity: string;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:156
目标实体名
entityId
readonly entityId: string;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:158
目标实体主键
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
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
namespace
readonly namespace: string;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:154
目标实体的命名空间
property
readonly property: string;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:164
命中处的加密属性名
reason
readonly reason: CommitEncryptedAtRestReason;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:166
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
unitId
readonly unitId: string;
Defined in: packages/rxdb-plugin-working-tree/src/commit/commit-codec.ts:160
命中处所属的变更单元
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
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
| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
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
| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces