exception中两个异常归类到userException下面

This commit is contained in:
Xu Chang 2024-05-16 17:01:22 +08:00
parent 8f3933a4ba
commit 74054a9820
3 changed files with 62 additions and 61 deletions

View File

@ -15,21 +15,6 @@ export declare class OakMakeSureByMySelfException<ED extends EntityDict> extends
}
export declare class OakDataException<ED extends EntityDict> extends OakException<ED> {
}
export declare class OakUniqueViolationException<ED extends EntityDict> extends OakException<ED> {
rows: Array<{
id?: string;
attrs: string[];
}>;
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string);
}
export declare class OakImportDataParseException<ED extends EntityDict> extends OakException<ED> {
line: number;
header?: string;
constructor(message: string, line: number, header?: string);
}
export declare class OakNoRelationDefException<ED extends EntityDict, T extends keyof ED> extends OakDataException<ED> {
entity: T;
actions: ED[T]['Action'][];
@ -55,6 +40,21 @@ export declare class OakRowUnexistedException<ED extends EntityDict> extends Oak
*/
export declare class OakUserException<ED extends EntityDict> extends OakException<ED> {
}
export declare class OakUniqueViolationException<ED extends EntityDict> extends OakUserException<ED> {
rows: Array<{
id?: string;
attrs: string[];
}>;
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string);
}
export declare class OakImportDataParseException<ED extends EntityDict> extends OakUserException<ED> {
line: number;
header?: string;
constructor(message: string, line: number, header?: string);
}
/**
*
*/

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakMakeSureByMySelfException = exports.OakException = void 0;
exports.makeException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakMakeSureByMySelfException = exports.OakException = void 0;
class OakException extends Error {
opRecords;
constructor(message) {
@ -51,25 +51,6 @@ exports.OakMakeSureByMySelfException = OakMakeSureByMySelfException;
class OakDataException extends OakException {
}
exports.OakDataException = OakDataException;
class OakUniqueViolationException extends OakException {
rows;
constructor(rows, message) {
super(message || '您更新的数据违反了唯一性约束');
this.rows = rows;
}
}
exports.OakUniqueViolationException = OakUniqueViolationException;
class OakImportDataParseException extends OakException {
line;
header;
// message必传描述具体错误的数据内容
constructor(message, line, header) {
super(message);
this.line = line;
this.header = header;
}
}
exports.OakImportDataParseException = OakImportDataParseException;
class OakNoRelationDefException extends OakDataException {
entity;
actions;
@ -117,6 +98,25 @@ class OakUserException extends OakException {
}
exports.OakUserException = OakUserException;
;
class OakUniqueViolationException extends OakUserException {
rows;
constructor(rows, message) {
super(message || '您更新的数据违反了唯一性约束');
this.rows = rows;
}
}
exports.OakUniqueViolationException = OakUniqueViolationException;
class OakImportDataParseException extends OakUserException {
line;
header;
// message必传描述具体错误的数据内容
constructor(message, line, header) {
super(message);
this.line = line;
this.header = header;
}
}
exports.OakImportDataParseException = OakImportDataParseException;
/**
* 网络中断异常
*/

View File

@ -57,32 +57,6 @@ export class OakDataException<ED extends EntityDict> extends OakException<ED> {
// 表示由数据层发现的异常
}
export class OakUniqueViolationException<ED extends EntityDict> extends OakException<ED> {
rows: Array<{
id?: string;
attrs: string[];
}>;
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string) {
super(message || '您更新的数据违反了唯一性约束');
this.rows = rows;
}
}
export class OakImportDataParseException<ED extends EntityDict> extends OakException<ED> {
line: number;
header?: string;
// message必传描述具体错误的数据内容
constructor(message: string, line: number, header?: string) {
super(message);
this.line = line;
this.header = header;
}
}
export class OakNoRelationDefException<ED extends EntityDict, T extends keyof ED> extends OakDataException<ED> {
entity: T;
actions: ED[T]['Action'][];
@ -137,6 +111,33 @@ export class OakUserException<ED extends EntityDict> extends OakException<ED> {
// 继承了这个类的异常统一视为“可接受的、由用户操作造成的异常”
};
export class OakUniqueViolationException<ED extends EntityDict> extends OakUserException<ED> {
rows: Array<{
id?: string;
attrs: string[];
}>;
constructor(rows: Array<{
id?: string;
attrs: string[];
}>, message?: string) {
super(message || '您更新的数据违反了唯一性约束');
this.rows = rows;
}
}
export class OakImportDataParseException<ED extends EntityDict> extends OakUserException<ED> {
line: number;
header?: string;
// message必传描述具体错误的数据内容
constructor(message: string, line: number, header?: string) {
super(message);
this.line = line;
this.header = header;
}
}
/**
*
*/