feat: 注册异常处理器时显示名称

This commit is contained in:
Pan Qiancheng 2025-11-11 12:03:12 +08:00
parent e646236e8d
commit 2d917d3648
2 changed files with 8 additions and 2 deletions

View File

@ -32,7 +32,10 @@ class AppLoader extends types_1.AppLoader {
regAllExceptionHandler() {
const handlers = this.requireSth('lib/configuration/exception');
if (Array.isArray(handlers)) {
handlers.forEach((handler) => this.registerInternalErrorHandler(handler));
handlers.forEach((handler) => {
console.log(`注册内部错误处理器: ${handler.name}`);
this.registerInternalErrorHandler(handler);
});
}
else {
console.warn('lib/configuration/exception必须默认导出一个处理器数组当前导出类型不正确将忽略此配置');

View File

@ -40,7 +40,10 @@ export class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt extends Backe
const handlers = this.requireSth('lib/configuration/exception') as Array<InternalErrorHandler<ED, Cxt>> | InternalErrorHandler<ED, Cxt>;
if (Array.isArray(handlers)) {
handlers.forEach(
(handler) => this.registerInternalErrorHandler(handler)
(handler) => {
console.log(`注册内部错误处理器: ${handler.name}`);
this.registerInternalErrorHandler(handler);
}
);
} else {
console.warn('lib/configuration/exception必须默认导出一个处理器数组当前导出类型不正确将忽略此配置');