增加了preconditionUnset的异常
This commit is contained in:
parent
c9a6f15811
commit
da240d298f
|
|
@ -92,6 +92,12 @@ export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyo
|
|||
export declare class OakDeadlock<ED extends EntityDict> extends OakUserException<ED> {
|
||||
constructor(message?: string | undefined);
|
||||
}
|
||||
export declare class OakPreConditionUnsetException<ED extends EntityDict> extends OakUserException<ED> {
|
||||
entity?: keyof ED;
|
||||
code?: string;
|
||||
constructor(message?: string | undefined, entity?: keyof ED | undefined, code?: string | undefined);
|
||||
toString(): string;
|
||||
}
|
||||
export declare function makeException<ED extends EntityDict>(data: {
|
||||
name: string;
|
||||
message?: string;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
||||
exports.makeException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var OakException = /** @class */ (function (_super) {
|
||||
|
|
@ -252,6 +252,25 @@ var OakDeadlock = /** @class */ (function (_super) {
|
|||
}(OakUserException));
|
||||
exports.OakDeadlock = OakDeadlock;
|
||||
;
|
||||
var OakPreConditionUnsetException = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(OakPreConditionUnsetException, _super);
|
||||
function OakPreConditionUnsetException(message, entity, code) {
|
||||
var _this = _super.call(this, message || '前置条件不满足') || this;
|
||||
_this.entity = entity,
|
||||
_this.code = code;
|
||||
return _this;
|
||||
}
|
||||
OakPreConditionUnsetException.prototype.toString = function () {
|
||||
return JSON.stringify({
|
||||
name: this.constructor.name,
|
||||
message: this.message,
|
||||
code: this.code,
|
||||
entity: this.entity,
|
||||
});
|
||||
};
|
||||
return OakPreConditionUnsetException;
|
||||
}(OakUserException));
|
||||
exports.OakPreConditionUnsetException = OakPreConditionUnsetException;
|
||||
function makeException(data) {
|
||||
var name = data.name;
|
||||
switch (name) {
|
||||
|
|
@ -320,6 +339,11 @@ function makeException(data) {
|
|||
e.setOpRecords(data.opRecords);
|
||||
return e;
|
||||
}
|
||||
case 'OakPreConditionUnsetException': {
|
||||
var e = new OakPreConditionUnsetException(data.message, data.entity, data.code);
|
||||
e.setOpRecords(data.opRecords);
|
||||
return e;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,6 +230,27 @@ export class OakDeadlock<ED extends EntityDict> extends OakUserException<ED> {
|
|||
}
|
||||
};
|
||||
|
||||
export class OakPreConditionUnsetException<ED extends EntityDict> extends OakUserException<ED> {
|
||||
entity?: keyof ED;
|
||||
code?: string;
|
||||
|
||||
constructor(message?: string | undefined, entity?: keyof ED | undefined, code?: string | undefined) {
|
||||
super(message || '前置条件不满足');
|
||||
this.entity = entity,
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
toString(): string {
|
||||
return JSON.stringify({
|
||||
name: this.constructor.name,
|
||||
message: this.message,
|
||||
code: this.code,
|
||||
entity: this.entity,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function makeException<ED extends EntityDict>(data: {
|
||||
name: string;
|
||||
message?: string;
|
||||
|
|
@ -303,6 +324,11 @@ export function makeException<ED extends EntityDict>(data: {
|
|||
e.setOpRecords(data.opRecords);
|
||||
return e;
|
||||
}
|
||||
case 'OakPreConditionUnsetException': {
|
||||
const e = new OakPreConditionUnsetException(data.message, data.entity, data.code);
|
||||
e.setOpRecords(data.opRecords);
|
||||
return e;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue