UNPKG

@ticatec/node-common-library

Version:

A comprehensive Node.js database access framework providing robust abstractions for database connection management, SQL execution, transaction handling, pagination, and dynamic query building.

42 lines 2.09 kB
"use strict"; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _OptimisticLockException_entity; Object.defineProperty(exports, "__esModule", { value: true }); /** * 乐观锁异常类,用于处理并发更新冲突 */ class OptimisticLockException extends Error { /** * 构造函数 * @param message - 错误信息 * @param entity - 发生冲突的实体对象 */ constructor(message, entity) { super(message); _OptimisticLockException_entity.set(this, void 0); //@ts-ignore Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; __classPrivateFieldSet(this, _OptimisticLockException_entity, entity, "f"); } /** * 获取发生冲突的实体对象 * @returns 实体对象 */ get entity() { return __classPrivateFieldGet(this, _OptimisticLockException_entity, "f"); } } exports.default = OptimisticLockException; _OptimisticLockException_entity = new WeakMap(); //# sourceMappingURL=OptimisticLockException.js.map