diff --git a/lib/router/index.js b/lib/router/index.js index 036a4f64..c5dd5135 100644 --- a/lib/router/index.js +++ b/lib/router/index.js @@ -42,7 +42,12 @@ routerEvents.forEach((event) => { SingletonRouter.router.events.on(event, (...args) => { const eventField = `on${event.charAt(0).toUpperCase()}${event.substring(1)}` if (SingletonRouter[eventField]) { - SingletonRouter[eventField](...args) + try { + SingletonRouter[eventField](...args) + } catch (err) { + console.error(`Error when running the Router event: ${eventField}`) + console.error(`${err.message}\n${err.stack}`) + } } }) })