fix(v2): fix empty link error message (#3435)

* fix empty link error message

* fix snapshot
This commit is contained in:
Sébastien Lorber 2020-09-11 15:21:44 +02:00 committed by GitHub
parent 37989a00c3
commit 7ffe93903c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -119,10 +119,16 @@ async function convertToAssetLinkIfNeeded({
async function processLinkNode({node, index, parent, filePath, staticDir}) {
if (!node.url) {
// try to improve error feedback
// see https://github.com/facebook/docusaurus/issues/3309#issuecomment-690371675
const title =
node.title || (node.children[0] && node.children[0].value) || '?';
const line =
(node.position && node.position.start && node.position.start.line) || '?';
throw new Error(
`Markdown link url is mandatory. filePath=${toRelativePath(
filePath,
)}, title=${node.title}`,
)}, title=${title}, line=${line}`,
);
}