From a776a8402b7ae5bdc017409f26d4574bcee4858b Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 14 Jun 2021 17:53:14 +0200 Subject: [PATCH] feat(devtools): group navigation errors --- src/devtools.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devtools.ts b/src/devtools.ts index 1b270b167..c54b5e102 100644 --- a/src/devtools.ts +++ b/src/devtools.ts @@ -136,15 +136,16 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) { // color: 0xea5455, // }) - router.onError(error => { + router.onError((error, to) => { api.addTimelineEvent({ layerId: navigationsLayerId, event: { - title: 'Error', - subtitle: 'An uncaught error happened during navigation', + title: 'Error during Navigation', + subtitle: to.fullPath, logType: 'error', time: Date.now(), data: { error }, + groupId: (to.meta as any).__navigationId, }, }) }) @@ -172,6 +173,7 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) { event: { time: Date.now(), title: 'Start of navigation', + subtitle: to.fullPath, data, groupId: (to.meta as any).__navigationId, }, @@ -209,6 +211,7 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) { layerId: navigationsLayerId, event: { title: 'End of navigation', + subtitle: to.fullPath, time: Date.now(), data, logType: failure ? 'warning' : 'default',