🎨 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;
|
const fsPromises = fs.promises;
|
||||||
|
|
||||||
export default async (path: string) => {
|
export default async (path: string) => {
|
||||||
return fsPromises.readdir(path).catch(async (err) => {
|
return fsPromises.readdir(path);
|
||||||
throw new Error(`Could not list directory: ${path}`, err);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,27 +1,6 @@
|
||||||
// 3rd party dependencies
|
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
// Dependencies
|
|
||||||
import logger from "../../logger";
|
|
||||||
|
|
||||||
// Configuration
|
|
||||||
import { url } from "../../config/database";
|
import { url } from "../../config/database";
|
||||||
|
|
||||||
export const start = async () => {
|
export const connect = async () => {
|
||||||
await mongoose
|
await mongoose.connect(url);
|
||||||
.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);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue