🧑💻 Fixed more code smells
This commit is contained in:
parent
49091cb250
commit
05030fd1b8
1 changed files with 6 additions and 6 deletions
|
@ -4,18 +4,18 @@ import logger from "../../middlewares/logger";
|
|||
export const connect = async () => {
|
||||
await mongoose
|
||||
.connect(process.env.MONGO_URL)
|
||||
.then(async (connection) => {
|
||||
.then((connection) => {
|
||||
logger.info(`💾 Connected to database: ${connection.connection.name}`);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
logger.error("💾 Could not connect to database", e);
|
||||
.catch(() => {
|
||||
throw new Error("Error connecting to database.");
|
||||
});
|
||||
|
||||
mongoose.connection.on("error", async (error) => {
|
||||
logger.error(`💾 ${error}`);
|
||||
mongoose.connection.on("error", () => {
|
||||
throw new Error("Failed to connect to database.");
|
||||
});
|
||||
|
||||
mongoose.connection.on("warn", async (warning) => {
|
||||
mongoose.connection.on("warn", (warning) => {
|
||||
logger.warn(`💾 ${warning}`);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue