diff --git a/lib/AppLoader.js b/lib/AppLoader.js index 03c1161..e030ba7 100644 --- a/lib/AppLoader.js +++ b/lib/AppLoader.js @@ -41,15 +41,11 @@ class AppLoader extends types_1.AppLoader { */ async publishInternalError(type, message, err) { const errorToPublish = (0, lodash_1.cloneDeep)(err); - let oakException; - if (errorToPublish instanceof types_1.OakException) { - oakException = errorToPublish; - } await Promise.all(this.internalErrorHandlers.map((handler) => { return new Promise(async (resolve) => { try { const ctx = await this.makeContext(); - handler(ctx, type, message, errorToPublish, oakException); + handler(ctx, type, message, errorToPublish); } catch (e) { console.error('执行internalErrorHandler时出错', e); diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts index 7ab4e10..37d97a4 100644 --- a/lib/types/index.d.ts +++ b/lib/types/index.d.ts @@ -1,6 +1,6 @@ import { BaseEntityDict } from "oak-domain"; import { AsyncContext } from "oak-domain/lib/store/AsyncRowStore"; -import { EntityDict, OakException } from "oak-domain/lib/types"; +import { EntityDict } from "oak-domain/lib/types"; export type InternalErrorType = 'aspect' | 'trigger' | 'watcher' | 'timer' | 'checkpoint'; -export type InternalErrorHandler> = (ctx: Cxt, type: InternalErrorType, message: string, err: Error, oakException?: OakException) => Promise; +export type InternalErrorHandler> = (ctx: Cxt, type: InternalErrorType, message: string, err: Error) => Promise; export type ExceptionPublisher = (type: string, message: string, err: any) => Promise; diff --git a/src/AppLoader.ts b/src/AppLoader.ts index 4402da8..36a2322 100644 --- a/src/AppLoader.ts +++ b/src/AppLoader.ts @@ -49,16 +49,12 @@ export class AppLoader | undefined; - if (errorToPublish instanceof OakException) { - oakException = errorToPublish; - } await Promise.all(this.internalErrorHandlers.map( (handler) => { return new Promise(async (resolve) => { try { const ctx = await this.makeContext(); - handler(ctx, type, message, errorToPublish, oakException); + handler(ctx, type, message, errorToPublish); } catch (e) { console.error('执行internalErrorHandler时出错', e); } finally { diff --git a/src/types/index.ts b/src/types/index.ts index f51d2fc..a9a6865 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -3,5 +3,5 @@ import { AsyncContext } from "oak-domain/lib/store/AsyncRowStore"; import { EntityDict, OakException } from "oak-domain/lib/types"; export type InternalErrorType = 'aspect' | 'trigger' | 'watcher' | 'timer' | 'checkpoint' -export type InternalErrorHandler> = (ctx: Cxt, type: InternalErrorType, message:string, err: Error, oakException?: OakException, ) => Promise; +export type InternalErrorHandler> = (ctx: Cxt, type: InternalErrorType, message:string, err: Error) => Promise; export type ExceptionPublisher = (type: string, message: string, err: any) => Promise; \ No newline at end of file