Unverified Commit 30240748 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Specify Invalid Dynamic Route Values (#9525)

parent 4656f52d
...@@ -320,7 +320,8 @@ export default class Router implements BaseRouter { ...@@ -320,7 +320,8 @@ export default class Router implements BaseRouter {
const routeMatch = getRouteMatcher(rr)(asPathname) const routeMatch = getRouteMatcher(rr)(asPathname)
if (!routeMatch) { if (!routeMatch) {
const error = const error =
'The provided `as` value is incompatible with the `href` value. This is invalid. https://err.sh/zeit/next.js/incompatible-href-as' `The provided \`as\` value (${asPathname}) is incompatible with the \`href\` value (${route}). ` +
`Read more: https://err.sh/zeit/next.js/incompatible-href-as`
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
throw new Error(error) throw new Error(error)
......
...@@ -86,7 +86,7 @@ describe('Invalid hrefs', () => { ...@@ -86,7 +86,7 @@ describe('Invalid hrefs', () => {
it('shows error when dynamic route mismatch is used on Link', async () => { it('shows error when dynamic route mismatch is used on Link', async () => {
await showsError( await showsError(
'/dynamic-route-mismatch', '/dynamic-route-mismatch',
/The provided `as` value is incompatible with the `href` value/, /The provided `as` value \(\/blog\/post-1\) is incompatible with the `href` value \(\/\[post\]\)/,
true true
) )
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment