Skip to content

Throw proper error when aborting navigation #3113

Closed
@protiumx

Description

@protiumx

Version

3.1.3

Reproduction link

https://codesandbox.io/s/vue-router-undefined-error-7ltnr

Steps to reproduce

  • Create route "/" and "/B"
  • Redirect to "/" inside "beforeEnter" in /"B" using next('/')
  • Push "/B" from "/"

What is expected?

To have a proper error object thrown

What is actually happening?

Undefined object thrown Uncaught (in promise) undefined


This only happens when using this.$router.push. The behaviour is not present using router-link.
Even though, I'd be great to always have proper errors. I suspect this is the line of code involved https://github.com/vuejs/vue-router/blob/dev/src/history/base.js#L163

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions