Skip to content

Frontmatter Parsing Failure Does Not Report Filename #2029

Open
@bliles

Description

@bliles
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

  • Create a file with frontmatter that cannot be properly parsed, for example, add an extra colon to an unquoted title attribute in yaml frontmatter
  • Run vuepress build
  • The frontmatter parser will report the problem with the content, but no indication of which file has the problem.

What is expected?

The error report should include the filepath of the file with the problem.

What is actually happening?

The error report only includes a sometime vague description of the problem, but not which file has the problem. Our vuepress site is being translated into several languages, the translators do not always format the frontmatter properly, and it is very time consuming to determine which file contains the bad frontmatter.

Other relevant information

It seems like the simplest option would be a try catch in core/lib/node/Page.js:process since in this function we know the filepath, I can open a PR if you like.

  • Output of npx vuepress info in my VuePress project:
$ npx vuepress info

Environment Info:

  System:
    OS: Linux 5.3 Pop!_OS 19.10
    CPU: (6) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  Binaries:
    Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
    Yarn: Not Found
    npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
  Browsers:
    Chrome: 78.0.3904.108
    Firefox: 70.0.1
  npmPackages:
    @vuepress/core:  1.0.1 
    @vuepress/theme-default:  1.0.1 
    vuepress: ^1.0.0-beta.2 => 1.0.1 
  npmGlobalPackages:
    vuepress: 1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions