fix: little bugs and refacto debug service

This commit is contained in:
Julien Froidefond
2025-03-06 21:41:24 +01:00
parent 0ca63a1fbd
commit 907e09682b
7 changed files with 84 additions and 67 deletions

View File

@@ -41,6 +41,7 @@ async function connectDB(): Promise<typeof mongoose> {
try {
cached.conn = await cached.promise;
} catch (e) {
console.error("Error connecting to MongoDB:", e);
cached.promise = null;
throw new AppError(ERROR_CODES.MONGODB.CONNECTION_FAILED, {}, e);
}