Skip to content

Commit

Permalink
feat(devtools): group navigation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jun 14, 2021
1 parent 4021acb commit a776a84
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/devtools.ts
Expand Up @@ -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,
},
})
})
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit a776a84

Please sign in to comment.