🎨 remove unnecessary error handling
This commit is contained in:
parent
ef8b20984d
commit
68bc3f6843
2 changed files with 3 additions and 26 deletions
|
@ -2,7 +2,5 @@ import fs from "fs";
|
|||
const fsPromises = fs.promises;
|
||||
|
||||
export default async (path: string) => {
|
||||
return fsPromises.readdir(path).catch(async (err) => {
|
||||
throw new Error(`Could not list directory: ${path}`, err);
|
||||
});
|
||||
return fsPromises.readdir(path);
|
||||
};
|
||||
|
|
|
@ -1,27 +1,6 @@
|
|||
// 3rd party dependencies
|
||||
import mongoose from "mongoose";
|
||||
|
||||
// Dependencies
|
||||
import logger from "../../logger";
|
||||
|
||||
// Configuration
|
||||
import { url } from "../../config/database";
|
||||
|
||||
export const start = async () => {
|
||||
await mongoose
|
||||
.connect(url)
|
||||
.then(async (connection) => {
|
||||
logger.info(`Connected to database: ${connection.connection.name}`);
|
||||
})
|
||||
.catch(async (e) => {
|
||||
logger.error("Could not connect to database", e);
|
||||
});
|
||||
|
||||
mongoose.connection.on("error", async (error) => {
|
||||
logger.error(`${error}`);
|
||||
});
|
||||
|
||||
mongoose.connection.on("warn", async (warning) => {
|
||||
logger.warn(warning);
|
||||
});
|
||||
export const connect = async () => {
|
||||
await mongoose.connect(url);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue