🎨 remove unnecessary error handling

This commit is contained in:
Axel Olausson Holtenäs 2022-07-05 01:38:49 +02:00
parent ef8b20984d
commit 68bc3f6843
No known key found for this signature in database
GPG key ID: 7BF6826B76382CBA
2 changed files with 3 additions and 26 deletions

View file

@ -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);
};

View file

@ -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);
};