OakExternalException增加了data域

This commit is contained in:
Xu Chang 2023-10-10 15:03:38 +08:00
parent 30ac1a3ddd
commit 3455fd893f
6 changed files with 17 additions and 15 deletions

View File

@ -1,7 +1,6 @@
import { ReadOnlyAction } from '../actions/action';
import { PrimaryKey, Sequence } from './DataType';
type TriggerDataAttributeType = '$$triggerData$$';
type TriggerTimestampAttributeType = '$$triggerTimestamp$$';
type TriggerUuidAttributeType = '$$triggerUuid$$';
type PrimaryKeyAttributeType = 'id';
type CreateAtAttributeType = '$$createAt$$';
@ -9,14 +8,13 @@ type UpdateAtAttributeType = '$$updateAt$$';
type DeleteAtAttributeType = '$$deleteAt$$';
type SeqAttributeType = '$$seq$$';
export declare const TriggerDataAttribute = "$$triggerData$$";
export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$";
export declare const TriggerUuidAttribute = "$$triggerUuid$$";
export declare const PrimaryKeyAttribute = "id";
export declare const CreateAtAttribute = "$$createAt$$";
export declare const UpdateAtAttribute = "$$updateAt$$";
export declare const DeleteAtAttribute = "$$deleteAt$$";
export declare const SeqAttribute = "$$seq$$";
export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType | TriggerUuidAttributeType;
export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | SeqAttributeType | TriggerUuidAttributeType;
export declare const initinctiveAttributes: string[];
type FilterPart<A extends string, F extends Object | undefined> = {
filter?: A extends 'create' ? undefined : F;

View File

@ -1,15 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerUuidAttribute = exports.TriggerTimestampAttribute = exports.TriggerDataAttribute = void 0;
exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerUuidAttribute = exports.TriggerDataAttribute = void 0;
exports.TriggerDataAttribute = '$$triggerData$$';
exports.TriggerTimestampAttribute = '$$triggerTimestamp$$';
exports.TriggerUuidAttribute = '$$triggerUuid$$';
exports.PrimaryKeyAttribute = 'id';
exports.CreateAtAttribute = '$$createAt$$';
exports.UpdateAtAttribute = '$$updateAt$$';
exports.DeleteAtAttribute = '$$deleteAt$$';
exports.SeqAttribute = '$$seq$$';
exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerTimestampAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerUuidAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
;
;
;

View File

@ -135,7 +135,8 @@ export declare class OakPreConditionUnsetException<ED extends EntityDict> extend
export declare class OakExternalException<ED extends EntityDict> extends OakUserException<ED> {
code?: string;
source: string;
constructor(source: string, code?: string, message?: string);
data?: any;
constructor(source: string, code?: string, message?: string, data?: any);
toString(): string;
}
export declare function makeException<ED extends EntityDict>(data: {

View File

@ -282,16 +282,19 @@ exports.OakPreConditionUnsetException = OakPreConditionUnsetException;
class OakExternalException extends OakUserException {
code;
source;
constructor(source, code, message) {
data;
constructor(source, code, message, data) {
super(message);
this.code = code;
this.source = source;
this.data = data;
}
toString() {
return JSON.stringify({
code: this.code,
message: this.message,
source: this.source,
data: this.data,
});
}
}
@ -385,7 +388,7 @@ function makeException(data) {
return e;
}
case 'OakExternalException': {
const e = new OakExternalException(data.source, data.code, data.message);
const e = new OakExternalException(data.source, data.code, data.message, data.data);
return e;
}
case 'OakNetworkException': {

View File

@ -2,7 +2,6 @@ import { ReadOnlyAction } from '../actions/action';
import { PrimaryKey, Sequence } from './DataType';
type TriggerDataAttributeType = '$$triggerData$$';
type TriggerTimestampAttributeType = '$$triggerTimestamp$$';
type TriggerUuidAttributeType = '$$triggerUuid$$';
type PrimaryKeyAttributeType = 'id';
type CreateAtAttributeType = '$$createAt$$';
@ -11,7 +10,6 @@ type DeleteAtAttributeType = '$$deleteAt$$';
type SeqAttributeType = '$$seq$$';
export const TriggerDataAttribute = '$$triggerData$$';
export const TriggerTimestampAttribute = '$$triggerTimestamp$$';
export const TriggerUuidAttribute = '$$triggerUuid$$';
export const PrimaryKeyAttribute = 'id';
export const CreateAtAttribute = '$$createAt$$';
@ -19,8 +17,8 @@ export const UpdateAtAttribute = '$$updateAt$$';
export const DeleteAtAttribute = '$$deleteAt$$';
export const SeqAttribute = '$$seq$$';
export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType| DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType | TriggerUuidAttributeType;
export const initinctiveAttributes = [PrimaryKeyAttribute, TriggerDataAttribute, TriggerTimestampAttribute, CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute, SeqAttribute];
export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType| DeleteAtAttributeType | TriggerDataAttributeType | SeqAttributeType | TriggerUuidAttributeType;
export const initinctiveAttributes = [PrimaryKeyAttribute, TriggerDataAttribute, TriggerUuidAttribute, CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute, SeqAttribute];
type FilterPart<A extends string, F extends Object | undefined> = {
filter?: A extends 'create' ? undefined : F;

View File

@ -311,11 +311,13 @@ export class OakPreConditionUnsetException<ED extends EntityDict> extends OakUse
export class OakExternalException<ED extends EntityDict> extends OakUserException<ED> {
code?: string;
source: string;
data?: any;
constructor(source: string, code?: string, message?: string) {
constructor(source: string, code?: string, message?: string, data?: any) {
super(message);
this.code = code;
this.source = source;
this.data = data;
}
toString(): string {
@ -323,6 +325,7 @@ export class OakExternalException<ED extends EntityDict> extends OakUserExceptio
code: this.code,
message: this.message,
source: this.source,
data: this.data,
});
}
}
@ -425,7 +428,7 @@ export function makeException<ED extends EntityDict>(data: {
return e;
}
case 'OakExternalException': {
const e = new OakExternalException(data.source, data.code, data.message);
const e = new OakExternalException(data.source, data.code, data.message, data.data);
return e;
}
case 'OakNetworkException': {