Commit cc9b1d6c authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

Catch router events errors and print them. (#2663)

parent cf130c70
......@@ -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}`)
}
}
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment