expect(spy).toHaveBeenCalled()
expect(spy).toHaveBeenLastCalledWith(error)
+ expect('uncaught error').toHaveBeenWarned()
expect(router.currentRoute.value).toMatchObject({
path: '/',
await router.push('/foo').catch(spy)
expect(spy).toHaveBeenCalled()
+ expect('uncaught error').toHaveBeenWarned()
expect(router.currentRoute.value).toMatchObject({
path: '/',
await router.push('/foo').catch(spy)
expect(spy).toHaveBeenCalledWith(error)
+ expect('uncaught error').toHaveBeenWarned()
expect(router.currentRoute.value).toMatchObject({
path: '/',
* @param error - error to throw
* @returns the error as a rejected promise
*/
- function triggerError(error: any) {
+ function triggerError(error: any): Promise<unknown> {
markAsReady(error)
- errorHandlers.list().forEach(handler => handler(error))
+ const list = errorHandlers.list()
+ if (list.length) {
+ list.forEach(handler => handler(error))
+ } else {
+ if (__DEV__) {
+ warn('uncaught error during route navigation:')
+ }
+ console.error(error)
+ }
return Promise.reject(error)
}