From 9bb033a96b99d54aaf880ac5bc78553f90ce05c6 Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Tue, 11 Nov 2025 10:37:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=ADoakErr=E4=BA=A4=E7=94=B1=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E8=87=AA=E5=B7=B1=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/AppLoader.js | 6 +----- lib/types/index.d.ts | 4 ++-- src/AppLoader.ts | 6 +----- src/types/index.ts | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) 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