Skip to content

onError does not capture errors thrown in redirect callback #3201

Closed
@trainiac

Description

@trainiac

Version

3.1.6

Reproduction link

https://codepen.io/trainiac/pen/rNOZvRO?editors=1112

Steps to reproduce

  1. create route config like
{
    path: '/oldpath/:part',
    redirect: (to: Route) => {
      if(to.ooopsmistake.part) {
        return `/newpath/${to.params.part}`
      }
      return '/newpath/'
    },
  }

What is expected?

When router.push('/oldpath/test'). an error is throw becuase there is no oopsmistake property on the to route. This should be caught in router.onError.

What is actually happening?

It's only caught in router.push('/oldpath/test').catch(err is here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions