修改了命名的关键字

This commit is contained in:
Xu Chang 2025-01-21 15:34:29 +08:00
parent 9e472a1d3b
commit 104d533ff0
3 changed files with 152 additions and 152 deletions

View File

@ -3,15 +3,15 @@ import { EntityDict, OpRecord } from "./Entity";
import { EntityDict as BaseEntityDict } from '../base-app-domain';
export declare class OakException<ED extends EntityDict & BaseEntityDict> extends Error {
opRecords: OpRecord<ED>[];
module?: string;
_module?: string;
params?: Record<string, any>;
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
addData<T extends keyof ED>(entity: T, rows: Partial<ED[T]['Schema']>[], schema: StorageSchema<ED>): void;
setOpRecords(opRecords: OpRecord<ED>[]): void;
getSerialData(): {
name: string;
message: string;
module: string | undefined;
_module: string | undefined;
opRecords: OpRecord<ED>[];
tag1: string | undefined;
tag2: boolean | undefined;
@ -34,7 +34,7 @@ export declare class OakDataException<ED extends EntityDict & BaseEntityDict> ex
export declare class OakNoRelationDefException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakDataException<ED> {
entity: T;
actions: ED[T]['Action'][];
constructor(entity: T, actions: ED[T]['Action'][], msg?: string, module?: string, params?: Record<string, any>);
constructor(entity: T, actions: ED[T]['Action'][], msg?: string, _module?: string, params?: Record<string, any>);
toString(): string;
}
export declare class OakOperExistedException<ED extends EntityDict & BaseEntityDict> extends OakDataException<ED> {
@ -44,7 +44,7 @@ export declare class OakRowUnexistedException<ED extends EntityDict & BaseEntity
constructor(rows: Array<{
entity: any;
selection: any;
}>, msg?: string, module?: string, params?: Record<string, any>);
}>, msg?: string, _module?: string, params?: Record<string, any>);
toString(): string;
getRows(): {
entity: any;
@ -64,12 +64,12 @@ export declare class OakUniqueViolationException<ED extends EntityDict & BaseEnt
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string, module?: string, params?: Record<string, any>);
}>, message?: string, _module?: string, params?: Record<string, any>);
}
export declare class OakImportDataParseException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
line: number;
header?: string;
constructor(message: string, line: number, header?: string, module?: string, params?: Record<string, any>);
constructor(message: string, line: number, header?: string, _module?: string, params?: Record<string, any>);
}
/**
*
@ -81,7 +81,7 @@ export declare class OakServerProxyException<ED extends EntityDict & BaseEntityD
export declare class OakClockDriftException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
}
export declare class OakSignatureVerificationException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
/**
*
@ -96,7 +96,7 @@ export declare class OakRowInconsistencyException<ED extends EntityDict & BaseEn
export declare class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
private attributes;
private entity;
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
getEntity(): keyof ED;
getAttributes(): string[];
addAttributesPrefix(prefix: string): void;
@ -106,13 +106,13 @@ export declare class OakInputIllegalException<ED extends EntityDict & BaseEntity
*
*/
export declare class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
}
/**
* update时对应属性的露出
*/
export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
}
/**
*
@ -120,7 +120,7 @@ export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEnti
export declare class OakOperationUnpermittedException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
private entity;
private operation;
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>);
toString(): string;
}
/**
@ -129,20 +129,20 @@ export declare class OakOperationUnpermittedException<ED extends EntityDict & Ba
export declare class OakDataInvisibleException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
private entity;
private operation;
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>);
toString(): string;
}
/**
*
*/
export declare class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
/**
*
*/
export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
/**
*
@ -150,7 +150,7 @@ export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDic
export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
private data;
private entity;
constructor(entity: T, data: ED[T]['OpSchema'], message?: string, module?: string, params?: Record<string, any>);
constructor(entity: T, data: ED[T]['OpSchema'], message?: string, _module?: string, params?: Record<string, any>);
getData(): ED[T]["OpSchema"];
getEntity(): T;
toString(): string;
@ -159,7 +159,7 @@ export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDic
*
*/
export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
/**
*
@ -167,7 +167,7 @@ export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends
export declare class OakPreConditionUnsetException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
entity?: keyof ED;
code?: string;
constructor(message?: string, entity?: keyof ED, code?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, entity?: keyof ED, code?: string, _module?: string, params?: Record<string, any>);
toString(): string;
}
/**
@ -177,19 +177,19 @@ export declare class OakExternalException<ED extends EntityDict & BaseEntityDict
code?: string;
source: string;
data?: any;
constructor(source: string, code?: string, message?: string, data?: any, module?: string, params?: Record<string, any>);
constructor(source: string, code?: string, message?: string, data?: any, _module?: string, params?: Record<string, any>);
toString(): string;
}
/**
* socket连接异常
*/
export declare class OakSocketConnectException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
export declare function makeException<ED extends EntityDict & BaseEntityDict>(data: {
name: string;
message?: string;
module?: string;
_module?: string;
params?: Record<string, any>;
opRecords: OpRecord<ED>[];
[A: string]: any;

View File

@ -5,11 +5,11 @@ const relation_1 = require("../store/relation");
const lodash_1 = require("../utils/lodash");
class OakException extends Error {
opRecords;
module;
_module;
params;
constructor(message, module, params) {
constructor(message, _module, params) {
super(message);
this.module = module;
this._module = _module;
this.params = params;
this.name = new.target.name;
if (typeof Error.captureStackTrace === 'function') {
@ -79,7 +79,7 @@ class OakException extends Error {
return {
name: this.constructor.name,
message: this.message,
module: this.module,
_module: this._module,
opRecords: this.opRecords,
tag1: this.tag1,
tag2: this.tag2,
@ -116,8 +116,8 @@ exports.OakDataException = OakDataException;
class OakNoRelationDefException extends OakDataException {
entity;
actions;
constructor(entity, actions, msg, module, params) {
super(msg || 'error::noRelationDef', module || 'oak-domain', params || {
constructor(entity, actions, msg, _module, params) {
super(msg || 'error::noRelationDef', _module || 'oak-domain', params || {
entity,
actions: actions.join(',')
});
@ -140,8 +140,8 @@ exports.OakOperExistedException = OakOperExistedException;
class OakRowUnexistedException extends OakDataException {
rows;
// 指定主键查询时却发现行不存在,一般发生在缓存中
constructor(rows, msg, module, params) {
super(msg || 'error::rowUnexisted', module || 'oak-domain', params || {
constructor(rows, msg, _module, params) {
super(msg || 'error::rowUnexisted', _module || 'oak-domain', params || {
entity: rows[0].entity,
});
this.rows = rows;
@ -167,8 +167,8 @@ exports.OakUserException = OakUserException;
;
class OakUniqueViolationException extends OakUserException {
rows;
constructor(rows, message, module, params) {
super(message || 'error::uniqViolation', module || 'oak-domain', params);
constructor(rows, message, _module, params) {
super(message || 'error::uniqViolation', _module || 'oak-domain', params);
this.rows = rows;
}
}
@ -177,8 +177,8 @@ class OakImportDataParseException extends OakUserException {
line;
header;
// message必传描述具体错误的数据内容
constructor(message, line, header, module, params) {
super(message || 'error::importedDataParseError', module || 'oak-domain', params);
constructor(message, line, header, _module, params) {
super(message || 'error::importedDataParseError', _module || 'oak-domain', params);
this.line = line;
this.header = header;
}
@ -200,8 +200,8 @@ class OakClockDriftException extends OakException {
exports.OakClockDriftException = OakClockDriftException;
// 验签失败
class OakSignatureVerificationException extends OakException {
constructor(message, module, params) {
super(message || 'error::signatureFailed', module || 'oak-domain', params);
constructor(message, _module, params) {
super(message || 'error::signatureFailed', _module || 'oak-domain', params);
}
}
exports.OakSignatureVerificationException = OakSignatureVerificationException;
@ -224,8 +224,8 @@ exports.OakRowInconsistencyException = OakRowInconsistencyException;
class OakInputIllegalException extends OakUserException {
attributes;
entity;
constructor(entity, attributes, message, module, params) {
super(message, module, params);
constructor(entity, attributes, message, _module, params) {
super(message, _module, params);
this.entity = entity;
this.attributes = attributes;
}
@ -253,8 +253,8 @@ exports.OakInputIllegalException = OakInputIllegalException;
* 属性为空时抛的异常
*/
class OakAttrNotNullException extends OakInputIllegalException {
constructor(entity, attributes, message, module, params) {
super(entity, attributes, message || 'error::attributesNull', module || 'oak-domain', params);
constructor(entity, attributes, message, _module, params) {
super(entity, attributes, message || 'error::attributesNull', _module || 'oak-domain', params);
}
}
exports.OakAttrNotNullException = OakAttrNotNullException;
@ -262,8 +262,8 @@ exports.OakAttrNotNullException = OakAttrNotNullException;
* 属性不允许更新抛的异常前端可以用这个异常来处理update时对应属性的露出
*/
class OakAttrCantUpdateException extends OakInputIllegalException {
constructor(entity, attributes, message, module, params) {
super(entity, attributes, message || 'error::attributesCantUpdate', module || 'oak-domain', params);
constructor(entity, attributes, message, _module, params) {
super(entity, attributes, message || 'error::attributesCantUpdate', _module || 'oak-domain', params);
}
}
exports.OakAttrCantUpdateException = OakAttrCantUpdateException;
@ -273,8 +273,8 @@ exports.OakAttrCantUpdateException = OakAttrCantUpdateException;
class OakOperationUnpermittedException extends OakUserException {
entity;
operation;
constructor(entity, operation, message, module, params) {
super(message || 'error::operationUnpermitted', module || 'oak-domain', params);
constructor(entity, operation, message, _module, params) {
super(message || 'error::operationUnpermitted', _module || 'oak-domain', params);
this.entity = entity;
this.operation = operation;
}
@ -295,8 +295,8 @@ exports.OakOperationUnpermittedException = OakOperationUnpermittedException;
class OakDataInvisibleException extends OakUserException {
entity;
operation;
constructor(entity, operation, message, module, params) {
super(message || 'error::dataInvisible', module || 'oak-domain', params);
constructor(entity, operation, message, _module, params) {
super(message || 'error::dataInvisible', _module || 'oak-domain', params);
this.entity = entity;
this.operation = operation;
}
@ -315,8 +315,8 @@ exports.OakDataInvisibleException = OakDataInvisibleException;
* 用户未登录抛的异常
*/
class OakUnloggedInException extends OakUserException {
constructor(message, module, params) {
super(message || 'error::unLoggedIn', module || 'oak-domain', params);
constructor(message, _module, params) {
super(message || 'error::unLoggedIn', _module || 'oak-domain', params);
}
}
exports.OakUnloggedInException = OakUnloggedInException;
@ -325,8 +325,8 @@ exports.OakUnloggedInException = OakUnloggedInException;
* 行数据被锁抛的异常
*/
class OakRowLockedException extends OakUserException {
constructor(message, module, params) {
super(message || 'error::rowLocked', module || 'oak-domain', params);
constructor(message, _module, params) {
super(message || 'error::rowLocked', _module || 'oak-domain', params);
}
}
exports.OakRowLockedException = OakRowLockedException;
@ -337,8 +337,8 @@ exports.OakRowLockedException = OakRowLockedException;
class OakCongruentRowExists extends OakUserException {
data;
entity;
constructor(entity, data, message, module, params) {
super(message || 'error::congrentRowExists', module || 'oak-domain', params);
constructor(entity, data, message, _module, params) {
super(message || 'error::congrentRowExists', _module || 'oak-domain', params);
this.data = data;
this.entity = entity;
}
@ -362,8 +362,8 @@ exports.OakCongruentRowExists = OakCongruentRowExists;
* 死锁抛的异常
*/
class OakDeadlock extends OakUserException {
constructor(message, module, params) {
super(message || 'error::deadlock', module || 'oak-domain', params);
constructor(message, _module, params) {
super(message || 'error::deadlock', _module || 'oak-domain', params);
}
}
exports.OakDeadlock = OakDeadlock;
@ -374,8 +374,8 @@ exports.OakDeadlock = OakDeadlock;
class OakPreConditionUnsetException extends OakUserException {
entity;
code;
constructor(message, entity, code, module, params) {
super(message || 'error::preconditionUnset', module || 'oak-domain', params);
constructor(message, entity, code, _module, params) {
super(message || 'error::preconditionUnset', _module || 'oak-domain', params);
this.entity = entity,
this.code = code;
}
@ -396,8 +396,8 @@ class OakExternalException extends OakUserException {
code;
source;
data;
constructor(source, code, message, data, module, params) {
super(message || 'error::externalException', module || 'oak-domain', params);
constructor(source, code, message, data, _module, params) {
super(message || 'error::externalException', _module || 'oak-domain', params);
this.code = code;
this.source = source;
this.data = data;
@ -417,118 +417,118 @@ exports.OakExternalException = OakExternalException;
* socket连接异常
*/
class OakSocketConnectException extends OakUserException {
constructor(message, module, params) {
super(message || 'error::socketConnectException', module || 'oak-domain', params);
constructor(message, _module, params) {
super(message || 'error::socketConnectException', _module || 'oak-domain', params);
}
}
exports.OakSocketConnectException = OakSocketConnectException;
;
function makeException(data) {
const { name, message, module, params } = data;
const { name, message, _module, params } = data;
let e = undefined;
switch (name) {
case 'OakException': {
e = new OakException(message, module, params);
e = new OakException(message, _module, params);
break;
}
case 'OakUserException': {
e = new OakUserException(message, module, params);
e = new OakUserException(message, _module, params);
break;
}
case 'OakRowInconsistencyException': {
e = new OakRowInconsistencyException(message, module, params);
e = new OakRowInconsistencyException(message, _module, params);
break;
}
case 'OakInputIllegalException': {
e = new OakInputIllegalException(data.entity, data.attributes, message, module, params);
e = new OakInputIllegalException(data.entity, data.attributes, message, _module, params);
break;
}
case 'OakAttrCantUpdateException': {
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, module, params);
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, _module, params);
break;
}
case 'OakOperationUnpermittedException': {
e = new OakOperationUnpermittedException(data.entity, data.operation, message, module, params);
e = new OakOperationUnpermittedException(data.entity, data.operation, message, _module, params);
break;
}
case 'OakDataInvisibleException': {
e = new OakDataInvisibleException(data.entity, data.operation, message, module, params);
e = new OakDataInvisibleException(data.entity, data.operation, message, _module, params);
break;
}
case 'OakUnloggedInException': {
e = new OakUnloggedInException(message, module, params);
e = new OakUnloggedInException(message, _module, params);
break;
}
case 'OakCongruentRowExists': {
e = new OakCongruentRowExists(data.entity, data.data, message, module, params);
e = new OakCongruentRowExists(data.entity, data.data, message, _module, params);
break;
}
case 'OakRowLockedException': {
e = new OakRowLockedException(message, module, params);
e = new OakRowLockedException(message, _module, params);
break;
}
case 'OakRowUnexistedException': {
e = new OakRowUnexistedException(data.rows, message, module, params);
e = new OakRowUnexistedException(data.rows, message, _module, params);
break;
}
case 'OakDeadlock': {
e = new OakDeadlock(message, module, params);
e = new OakDeadlock(message, _module, params);
break;
}
case 'OakDataException': {
e = new OakDataException(message, module, params);
e = new OakDataException(message, _module, params);
break;
}
case 'OakNoRelationDefException': {
e = new OakNoRelationDefException(data.entity, data.action, message, module, params);
e = new OakNoRelationDefException(data.entity, data.action, message, _module, params);
break;
}
case 'OakUniqueViolationException': {
e = new OakUniqueViolationException(data.rows, message, module, params);
e = new OakUniqueViolationException(data.rows, message, _module, params);
break;
}
case 'OakImportDataParseException': {
e = new OakImportDataParseException(message, data.line, data.header, module, params);
e = new OakImportDataParseException(message, data.line, data.header, _module, params);
break;
}
case 'OakPreConditionUnsetException': {
e = new OakPreConditionUnsetException(message, data.entity, data.code, module, params);
e = new OakPreConditionUnsetException(message, data.entity, data.code, _module, params);
break;
}
case 'OakAttrNotNullException': {
e = new OakAttrNotNullException(data.entity, data.attributes, message, module, params);
e = new OakAttrNotNullException(data.entity, data.attributes, message, _module, params);
break;
}
case 'OakExternalException': {
e = new OakExternalException(data.source, data.code, message, data.data, module, params);
e = new OakExternalException(data.source, data.code, message, data.data, _module, params);
break;
}
case 'OakNetworkException': {
e = new OakNetworkException(message, module, params);
e = new OakNetworkException(message, _module, params);
break;
}
case 'OakClockDriftException': {
e = new OakClockDriftException(message, module, params);
e = new OakClockDriftException(message, _module, params);
break;
}
case 'OakServerProxyException': {
e = new OakServerProxyException(message, module, params);
e = new OakServerProxyException(message, _module, params);
break;
}
case 'OakSocketConnectException': {
e = new OakSocketConnectException(message, module, params);
e = new OakSocketConnectException(message, _module, params);
break;
}
case 'OakPartialSuccess': {
e = new OakPartialSuccess(message, module, params);
e = new OakPartialSuccess(message, _module, params);
break;
}
case 'OakRequestTimeoutException': {
e = new OakRequestTimeoutException(message, module, params);
e = new OakRequestTimeoutException(message, _module, params);
break;
}
case 'OakSignatureVerificationException': {
e = new OakSignatureVerificationException(message, module, params);
e = new OakSignatureVerificationException(message, _module, params);
break;
}
default:

View File

@ -7,11 +7,11 @@ import { pick } from '../utils/lodash';
export class OakException<ED extends EntityDict & BaseEntityDict> extends Error {
opRecords: OpRecord<ED>[];
module?: string;
_module?: string;
params?: Record<string, any>;
constructor(message?: string, module?: string, params?: Record<string, any>) {
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message);
this.module = module;
this._module = _module;
this.params = params;
this.name = new.target.name;
if (typeof (Error as any).captureStackTrace === 'function') {
@ -89,7 +89,7 @@ export class OakException<ED extends EntityDict & BaseEntityDict> extends Error
return {
name: this.constructor.name,
message: this.message,
module: this.module,
_module: this._module,
opRecords: this.opRecords,
tag1: this.tag1,
@ -132,8 +132,8 @@ export class OakDataException<ED extends EntityDict & BaseEntityDict> extends Oa
export class OakNoRelationDefException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakDataException<ED> {
entity: T;
actions: ED[T]['Action'][];
constructor(entity: T, actions: ED[T]['Action'][], msg?: string, module?: string, params?: Record<string, any>) {
super(msg || 'error::noRelationDef', module || 'oak-domain', params || {
constructor(entity: T, actions: ED[T]['Action'][], msg?: string, _module?: string, params?: Record<string, any>) {
super(msg || 'error::noRelationDef', _module || 'oak-domain', params || {
entity,
actions: actions.join(',')
});
@ -161,8 +161,8 @@ export class OakRowUnexistedException<ED extends EntityDict & BaseEntityDict> ex
selection: any;
}>
// 指定主键查询时却发现行不存在,一般发生在缓存中
constructor(rows: Array<{entity: any, selection: any}>, msg?: string, module?: string, params?: Record<string, any>) {
super(msg || 'error::rowUnexisted', module || 'oak-domain', params || {
constructor(rows: Array<{entity: any, selection: any}>, msg?: string, _module?: string, params?: Record<string, any>) {
super(msg || 'error::rowUnexisted', _module || 'oak-domain', params || {
entity: rows[0].entity,
});
this.rows = rows;
@ -197,8 +197,8 @@ export class OakUniqueViolationException<ED extends EntityDict & BaseEntityDict>
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::uniqViolation', module || 'oak-domain', params);
}>, message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::uniqViolation', _module || 'oak-domain', params);
this.rows = rows;
}
}
@ -208,8 +208,8 @@ export class OakImportDataParseException<ED extends EntityDict & BaseEntityDict>
header?: string;
// message必传描述具体错误的数据内容
constructor(message: string, line: number, header?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::importedDataParseError', module || 'oak-domain', params);
constructor(message: string, line: number, header?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::importedDataParseError', _module || 'oak-domain', params);
this.line = line;
this.header = header;
}
@ -234,8 +234,8 @@ export class OakClockDriftException<ED extends EntityDict & BaseEntityDict> exte
// 验签失败
export class OakSignatureVerificationException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::signatureFailed', module || 'oak-domain', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::signatureFailed', _module || 'oak-domain', params);
}
}
@ -257,8 +257,8 @@ export class OakRowInconsistencyException<ED extends EntityDict & BaseEntityDict
export class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
private attributes: string[];
private entity: keyof ED;
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>) {
super(message, module, params);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>) {
super(message, _module, params);
this.entity = entity;
this.attributes = attributes;
}
@ -291,8 +291,8 @@ export class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> ex
*
*/
export class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>) {
super(entity, attributes, message || 'error::attributesNull', module || 'oak-domain', params);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>) {
super(entity, attributes, message || 'error::attributesNull', _module || 'oak-domain', params);
}
}
@ -300,8 +300,8 @@ export class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> ext
* update时对应属性的露出
*/
export class OakAttrCantUpdateException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
constructor(entity: keyof ED, attributes: string[], message?: string, module?: string, params?: Record<string, any>) {
super(entity, attributes, message || 'error::attributesCantUpdate', module || 'oak-domain', params);
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>) {
super(entity, attributes, message || 'error::attributesCantUpdate', _module || 'oak-domain', params);
}
}
@ -312,8 +312,8 @@ export class OakOperationUnpermittedException<ED extends EntityDict & BaseEntity
private entity: T;
private operation: ED[T]['Selection'] | ED[T]['Operation'];
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::operationUnpermitted', module || 'oak-domain', params);
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::operationUnpermitted', _module || 'oak-domain', params);
this.entity = entity;
this.operation = operation;
}
@ -336,8 +336,8 @@ export class OakDataInvisibleException<ED extends EntityDict & BaseEntityDict, T
private entity: T;
private operation: ED[T]['Selection'] | ED[T]['Operation'];
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::dataInvisible', module || 'oak-domain', params);
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::dataInvisible', _module || 'oak-domain', params);
this.entity = entity;
this.operation = operation;
}
@ -358,8 +358,8 @@ export class OakDataInvisibleException<ED extends EntityDict & BaseEntityDict, T
*
*/
export class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::unLoggedIn', module || 'oak-domain', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::unLoggedIn', _module || 'oak-domain', params);
}
};
@ -368,8 +368,8 @@ export class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> exte
*
*/
export class OakRowLockedException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::rowLocked', module || 'oak-domain', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::rowLocked', _module || 'oak-domain', params);
}
};
/**
@ -378,8 +378,8 @@ export class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> exte
export class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
private data: ED[T]['OpSchema'];
private entity: T;
constructor(entity: T, data: ED[T]['OpSchema'], message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::congrentRowExists', module || 'oak-domain', params);
constructor(entity: T, data: ED[T]['OpSchema'], message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::congrentRowExists', _module || 'oak-domain', params);
this.data = data;
this.entity = entity;
}
@ -406,8 +406,8 @@ export class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T ext
*
*/
export class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::deadlock', module || 'oak-domain', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::deadlock', _module || 'oak-domain', params);
}
};
@ -418,8 +418,8 @@ export class OakPreConditionUnsetException<ED extends EntityDict & BaseEntityDic
entity?: keyof ED;
code?: string;
constructor(message?: string, entity?: keyof ED, code?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::preconditionUnset', module || 'oak-domain', params);
constructor(message?: string, entity?: keyof ED, code?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::preconditionUnset', _module || 'oak-domain', params);
this.entity = entity,
this.code = code;
}
@ -443,8 +443,8 @@ export class OakExternalException<ED extends EntityDict & BaseEntityDict> extend
source: string;
data?: any;
constructor(source: string, code?: string, message?: string, data?: any, module?: string, params?: Record<string, any>) {
super(message || 'error::externalException', module || 'oak-domain', params);
constructor(source: string, code?: string, message?: string, data?: any, _module?: string, params?: Record<string, any>) {
super(message || 'error::externalException', _module || 'oak-domain', params);
this.code = code;
this.source = source;
this.data = data;
@ -465,128 +465,128 @@ export class OakExternalException<ED extends EntityDict & BaseEntityDict> extend
* socket连接异常
*/
export class OakSocketConnectException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::socketConnectException', module || 'oak-domain', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::socketConnectException', _module || 'oak-domain', params);
}
};
export function makeException<ED extends EntityDict & BaseEntityDict>(data: {
name: string;
message?: string;
module?: string;
_module?: string;
params?: Record<string, any>;
opRecords: OpRecord<ED>[];
[A: string]: any;
}) {
const { name, message, module, params } = data;
const { name, message, _module, params } = data;
let e: OakException<ED> | undefined = undefined;
switch (name) {
case 'OakException': {
e = new OakException(message, module, params);
e = new OakException(message, _module, params);
break;
}
case 'OakUserException': {
e = new OakUserException(message, module, params);
e = new OakUserException(message, _module, params);
break;
}
case 'OakRowInconsistencyException': {
e = new OakRowInconsistencyException(message, module, params);
e = new OakRowInconsistencyException(message, _module, params);
break;
}
case 'OakInputIllegalException': {
e = new OakInputIllegalException(data.entity, data.attributes, message, module, params);
e = new OakInputIllegalException(data.entity, data.attributes, message, _module, params);
break;
}
case 'OakAttrCantUpdateException': {
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, module, params);
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, _module, params);
break;
}
case 'OakOperationUnpermittedException': {
e = new OakOperationUnpermittedException(data.entity, data.operation, message, module, params);
e = new OakOperationUnpermittedException(data.entity, data.operation, message, _module, params);
break;
}
case 'OakDataInvisibleException': {
e = new OakDataInvisibleException(data.entity, data.operation, message, module, params);
e = new OakDataInvisibleException(data.entity, data.operation, message, _module, params);
break;
}
case 'OakUnloggedInException': {
e = new OakUnloggedInException(message, module, params);
e = new OakUnloggedInException(message, _module, params);
break;
}
case 'OakCongruentRowExists': {
e = new OakCongruentRowExists(data.entity, data.data, message, module, params);
e = new OakCongruentRowExists(data.entity, data.data, message, _module, params);
break;
}
case 'OakRowLockedException': {
e = new OakRowLockedException(message, module, params);
e = new OakRowLockedException(message, _module, params);
break;
}
case 'OakRowUnexistedException': {
e = new OakRowUnexistedException(data.rows, message, module, params);
e = new OakRowUnexistedException(data.rows, message, _module, params);
break;
}
case 'OakDeadlock': {
e = new OakDeadlock(message, module, params);
e = new OakDeadlock(message, _module, params);
break;
}
case 'OakDataException': {
e = new OakDataException(message, module, params);
e = new OakDataException(message, _module, params);
break;
}
case 'OakNoRelationDefException': {
e = new OakNoRelationDefException(data.entity, data.action, message, module, params);
e = new OakNoRelationDefException(data.entity, data.action, message, _module, params);
break;
}
case 'OakUniqueViolationException': {
e = new OakUniqueViolationException(data.rows, message, module, params);
e = new OakUniqueViolationException(data.rows, message, _module, params);
break;
}
case 'OakImportDataParseException': {
e = new OakImportDataParseException(message!, data.line, data.header, module, params);
e = new OakImportDataParseException(message!, data.line, data.header, _module, params);
break;
}
case 'OakPreConditionUnsetException': {
e = new OakPreConditionUnsetException(message, data.entity, data.code, module, params);
e = new OakPreConditionUnsetException(message, data.entity, data.code, _module, params);
break;
}
case 'OakAttrNotNullException': {
e = new OakAttrNotNullException(
data.entity,
data.attributes,
message, module, params
message, _module, params
);
break;
}
case 'OakExternalException': {
e = new OakExternalException(data.source, data.code, message, data.data, module, params);
e = new OakExternalException(data.source, data.code, message, data.data, _module, params);
break;
}
case 'OakNetworkException': {
e = new OakNetworkException(message, module, params);
e = new OakNetworkException(message, _module, params);
break;
}
case 'OakClockDriftException': {
e = new OakClockDriftException(message, module, params);
e = new OakClockDriftException(message, _module, params);
break;
}
case 'OakServerProxyException': {
e = new OakServerProxyException(message, module, params);
e = new OakServerProxyException(message, _module, params);
break;
}
case 'OakSocketConnectException': {
e = new OakSocketConnectException(message, module, params);
e = new OakSocketConnectException(message, _module, params);
break;
}
case 'OakPartialSuccess': {
e = new OakPartialSuccess(message, module, params);
e = new OakPartialSuccess(message, _module, params);
break;
}
case 'OakRequestTimeoutException': {
e = new OakRequestTimeoutException(message, module, params);
e = new OakRequestTimeoutException(message, _module, params);
break;
}
case 'OakSignatureVerificationException': {
e = new OakSignatureVerificationException(message, module, params);
e = new OakSignatureVerificationException(message, _module, params);
break;
}
default: