import { StorageSchema } from "."; import { EntityDict, OpRecord } from "./Entity"; import { EntityDict as BaseEntityDict } from '../base-app-domain'; declare const OAK_EXCEPTION_SYMBOL: unique symbol; /** * 判断一个对象是否为 OakException 实例,作用和 `instanceof` 类似,但更安全可靠。 * 如OakUserException继承自OakException,使用时可传入OakUserException以进一步确认类型。 * @param obj 需要判断的对象 * @param exceptionName 可选参数,指定异常类名以进一步确认 * * ```ts * if (isOakException(e, OakUserException)) { * // 这里的 e 已被类型缩小为 OakUserException * } * ``` * * @returns 如果对象是 OakException 实例则返回 true,否则返回 false */ export declare function isOakException>(obj: any, errType?: new () => T): obj is T; export declare class OakException extends Error { opRecords: OpRecord[]; _module?: string; params?: Record; [OAK_EXCEPTION_SYMBOL]: boolean; constructor(message?: string, _module?: string, params?: Record); addData(entity: T, rows: Partial[], schema: StorageSchema): void; setOpRecords(opRecords: OpRecord[]): void; getSerialData(): { name: string; message: string; _module: string | undefined; params: Record | undefined; opRecords: OpRecord[]; tag1: string | undefined; tag2: boolean | undefined; tag3: any; }; toString(): string; tag1?: string; tag2?: boolean; tag3?: any; } export declare class OakRequestTimeoutException extends OakException { constructor(message?: string, ns?: string, params?: Record); } export declare class OakMakeSureByMySelfException extends OakException { } export declare class OakPartialSuccess extends OakException { } export declare class OakDataException extends OakException { } export declare class OakNoRelationDefException extends OakDataException { entity: T; actions: ED[T]['Action'][]; constructor(entity: T, actions: ED[T]['Action'][], msg?: string, _module?: string, params?: Record); toString(): string; } export declare class OakOperExistedException extends OakDataException { } export declare class OakRowUnexistedException extends OakDataException { private rows; constructor(rows: Array<{ entity: any; selection: any; }>, msg?: string, _module?: string, params?: Record); toString(): string; getRows(): { entity: any; selection: any; }[]; } /** * 可接受的、由用户操作造成的异常 */ 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, _module?: string, params?: Record); } export declare class OakImportDataParseException extends OakUserException { line: number; header?: string; constructor(message: string, line: number, header?: string, _module?: string, params?: Record); } /** * 网络中断异常 */ export declare class OakNetworkException extends OakException { } export declare class OakServerProxyException extends OakException { } export declare class OakClockDriftException extends OakException { } export declare class OakSignatureVerificationException extends OakException { constructor(message?: string, _module?: string, params?: Record); } /** * 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常 * */ export declare class OakRowInconsistencyException extends OakUserException { toString(): string; } /** * 当输入的数据非法时抛此异常,attributes表示非法的属性 */ export declare class OakInputIllegalException extends OakUserException { private attributes; private entity; constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record); getEntity(): keyof ED; getAttributes(): string[]; addAttributesPrefix(prefix: string): void; toString(): string; } /** * 属性为空时抛的异常 */ export declare class OakAttrNotNullException extends OakInputIllegalException { constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record); } /** * 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出 */ export declare class OakAttrCantUpdateException extends OakInputIllegalException { constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record); } /** * 用户权限不够时抛的异常 */ export declare class OakOperationUnpermittedException extends OakUserException { private entity; private operation; private userId?; constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], userId?: string, message?: string, _module?: string, params?: Record); toString(): string; } /** * 用户查询权限不够抛出异常 */ export declare class OakDataInvisibleException extends OakUserException { private entity; private operation; private userId?; constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], userId?: string, message?: string, _module?: string, params?: Record); toString(): string; } /** * 用户未登录抛的异常 */ export declare class OakUnloggedInException extends OakUserException { constructor(message?: string, _module?: string, params?: Record); } /** * 行数据被锁抛的异常 */ export declare class OakRowLockedException extends OakUserException { constructor(message?: string, _module?: string, params?: Record); } /** * 要插入行时,发现已经有相同的行数据 */ export declare class OakCongruentRowExists extends OakUserException { private data; private entity; constructor(entity: T, data: ED[T]['OpSchema'], message?: string, _module?: string, params?: Record); getData(): ED[T]["OpSchema"]; getEntity(): T; toString(): string; } /** * 死锁抛的异常 */ export declare class OakDeadlock extends OakUserException { constructor(message?: string, _module?: string, params?: Record); } /** * 前置条件不满足抛的异常 */ export declare class OakPreConditionUnsetException extends OakUserException { entity?: keyof ED; code?: string; constructor(message?: string, entity?: keyof ED, code?: string, _module?: string, params?: Record); toString(): string; } /** * 调用外部接口抛出的异常 */ export declare class OakExternalException extends OakUserException { code?: string; source: string; data?: any; constructor(source: string, code?: string, message?: string, data?: any, _module?: string, params?: Record); toString(): string; } /** * socket连接异常 */ export declare class OakSocketConnectException extends OakUserException { constructor(message?: string, _module?: string, params?: Record); } export declare class OakApplicationHasToUpgrade extends OakUserException { constructor(message?: string, _module?: string, params?: Record); } export declare function makeException(data: { name: string; message?: string; _module?: string; params?: Record; opRecords: OpRecord[]; [A: string]: any; }): OakException | undefined; export {};