From 2ab5d40c55c8d3789aa8b0b76a5c6830867686d0 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 16 Nov 2019 19:38:59 -0500 Subject: [PATCH] add logging to Server.loadRoutes() --- src/api/Server.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/api/Server.ts b/src/api/Server.ts index 18496b1..939abd9 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -31,9 +31,14 @@ export default class Server { const routes = await fs.readdir('./routes'); routes.forEach(async (routeFile) => { if (routeFile === 'index.js') return; - const route: Route = new (require(`./${routeFile}`))(this); - this.routes.set(route.conf.path, route); - this.app.use(route.conf.path, route.router); + try { + const route: Route = new (require(`./${routeFile}`))(this); + this.routes.set(route.conf.path, route); + this.app.use(route.conf.path, route.router); + this.client.signale.success(`Successfully loaded route ${route.conf.path}`); + } catch (error) { + this.client.signale.error(error); + } }); }