fix: err不能使用cloneDeep,会丢失不可枚举属性

This commit is contained in:
Pan Qiancheng 2026-01-15 15:37:51 +08:00
parent bda6e43ca7
commit f51d34ae1a
2 changed files with 2 additions and 4 deletions

View File

@ -57,13 +57,12 @@ class AppLoader extends types_1.AppLoader {
* 发布内部错误事件给注册的处理器
*/
async publishInternalError(type, message, err) {
const errorToPublish = (0, lodash_1.cloneDeep)(err);
await Promise.all(this.internalErrorHandlers.map((handler) => {
return new Promise(async (resolve) => {
const ctx = await this.makeContext();
try {
console.log(`调用internalErrorHandler【${handler.name}】处理内部错误事件`);
await handler.handle(ctx, type, message, errorToPublish);
await handler.handle(ctx, type, message, err);
await ctx.commit();
}
catch (e) {

View File

@ -66,14 +66,13 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
*
*/
private async publishInternalError(type: InternalErrorType, message: string, err: any) {
const errorToPublish = cloneDeep(err);
await Promise.all(this.internalErrorHandlers.map(
(handler) => {
return new Promise<void>(async (resolve) => {
const ctx = await this.makeContext();
try {
console.log(`调用internalErrorHandler【${handler.name}】处理内部错误事件`);
await handler.handle(ctx, type, message, errorToPublish);
await handler.handle(ctx, type, message, err);
await ctx.commit()
} catch (e) {
console.error('执行internalErrorHandler时出错', e);