From 74054a982027d78e8cff468122e9877e4d6f8dc1 Mon Sep 17 00:00:00 2001 From: Xc Date: Thu, 16 May 2024 17:01:22 +0800 Subject: [PATCH] =?UTF-8?q?exception=E4=B8=AD=E4=B8=A4=E4=B8=AA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=BD=92=E7=B1=BB=E5=88=B0userException=E4=B8=8B?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Exception.d.ts | 30 +++++++++++------------ lib/types/Exception.js | 40 +++++++++++++++--------------- src/types/Exception.ts | 53 ++++++++++++++++++++-------------------- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/lib/types/Exception.d.ts b/lib/types/Exception.d.ts index e862b05..a402084 100644 --- a/lib/types/Exception.d.ts +++ b/lib/types/Exception.d.ts @@ -15,21 +15,6 @@ export declare class OakMakeSureByMySelfException extends } export declare class OakDataException extends OakException { } -export declare class OakUniqueViolationException extends OakException { - rows: Array<{ - id?: string; - attrs: string[]; - }>; - constructor(rows: Array<{ - id?: string; - attrs: string[]; - }>, message?: string); -} -export declare class OakImportDataParseException extends OakException { - line: number; - header?: string; - constructor(message: string, line: number, header?: string); -} export declare class OakNoRelationDefException extends OakDataException { entity: T; actions: ED[T]['Action'][]; @@ -55,6 +40,21 @@ export declare class OakRowUnexistedException extends Oak */ export declare class OakUserException extends OakException { } +export declare class OakUniqueViolationException extends OakUserException { + rows: Array<{ + id?: string; + attrs: string[]; + }>; + constructor(rows: Array<{ + id?: string; + attrs: string[]; + }>, message?: string); +} +export declare class OakImportDataParseException extends OakUserException { + line: number; + header?: string; + constructor(message: string, line: number, header?: string); +} /** * 网络中断异常 */ diff --git a/lib/types/Exception.js b/lib/types/Exception.js index 18cbb6d..fad2ba6 100644 --- a/lib/types/Exception.js +++ b/lib/types/Exception.js @@ -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; /** * 网络中断异常 */ diff --git a/src/types/Exception.ts b/src/types/Exception.ts index 6a3eb54..050fbac 100644 --- a/src/types/Exception.ts +++ b/src/types/Exception.ts @@ -57,32 +57,6 @@ export class OakDataException extends OakException { // 表示由数据层发现的异常 } -export class OakUniqueViolationException extends OakException { - rows: Array<{ - id?: string; - attrs: string[]; - }>; - constructor(rows: Array<{ - id?: string; - attrs: string[]; - }>, message?: string) { - super(message || '您更新的数据违反了唯一性约束'); - this.rows = rows; - } -} - -export class OakImportDataParseException extends OakException { - line: number; - header?: string; - - // message必传,描述具体错误的数据内容 - constructor(message: string, line: number, header?: string) { - super(message); - this.line = line; - this.header = header; - } -} - export class OakNoRelationDefException extends OakDataException { entity: T; actions: ED[T]['Action'][]; @@ -137,6 +111,33 @@ export class OakUserException extends OakException { // 继承了这个类的异常统一视为“可接受的、由用户操作造成的异常” }; + +export class OakUniqueViolationException extends OakUserException { + rows: Array<{ + id?: string; + attrs: string[]; + }>; + constructor(rows: Array<{ + id?: string; + attrs: string[]; + }>, message?: string) { + super(message || '您更新的数据违反了唯一性约束'); + this.rows = rows; + } +} + +export class OakImportDataParseException extends OakUserException { + line: number; + header?: string; + + // message必传,描述具体错误的数据内容 + constructor(message: string, line: number, header?: string) { + super(message); + this.line = line; + this.header = header; + } +} + /** * 网络中断异常 */