From 5b6503a5d6d7e08a0e112cebae82e94e6187e035 Mon Sep 17 00:00:00 2001 From: jiayi <690405541@qq.com> Date: Fri, 28 Oct 2022 09:15:08 +0800 Subject: [PATCH] perf: connectionError to connectionErrorFactory --- lib/interfaces/mongoose-options.interface.ts | 2 +- lib/mongoose-core.module.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/interfaces/mongoose-options.interface.ts b/lib/interfaces/mongoose-options.interface.ts index 5db9b06d..01111a66 100644 --- a/lib/interfaces/mongoose-options.interface.ts +++ b/lib/interfaces/mongoose-options.interface.ts @@ -9,7 +9,7 @@ export interface MongooseModuleOptions retryDelay?: number; connectionName?: string; connectionFactory?: (connection: any, name: string) => any; - connectionError?: (error: MongooseError) => MongooseError; + connectionErrorFactory?: (error: MongooseError) => MongooseError; } export interface MongooseOptionsFactory { diff --git a/lib/mongoose-core.module.ts b/lib/mongoose-core.module.ts index 8565cbbf..34b94046 100644 --- a/lib/mongoose-core.module.ts +++ b/lib/mongoose-core.module.ts @@ -40,7 +40,7 @@ export class MongooseCoreModule implements OnApplicationShutdown { retryDelay, connectionName, connectionFactory, - connectionError, + connectionErrorFactory, ...mongooseOptions } = options; @@ -48,7 +48,7 @@ export class MongooseCoreModule implements OnApplicationShutdown { connectionFactory || ((connection) => connection); const mongooseConnectionError = - connectionError || ((error) => error); + connectionErrorFactory || ((error) => error); const mongooseConnectionName = getConnectionToken(connectionName); @@ -98,7 +98,7 @@ export class MongooseCoreModule implements OnApplicationShutdown { retryDelay, uri, connectionFactory, - connectionError, + connectionErrorFactory, ...mongooseOptions } = mongooseModuleOptions; @@ -106,7 +106,7 @@ export class MongooseCoreModule implements OnApplicationShutdown { connectionFactory || ((connection) => connection); const mongooseConnectionError = - connectionError || ((error) => error); + connectionErrorFactory || ((error) => error); return await lastValueFrom( defer(async () =>