bad error reporting for improper headers #17

Open
dherman opened this Issue Jul 20, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

dherman commented Jul 20, 2012

When an .md file has improperly indented headers it seems to crash the JS code and report an internal error. For example, running codex on a project with a file containing the following:


---
title: Home

---

Hello, world.

produces the error:

/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:179
  throw new Error(msg + ', ' + context(this.peek()[1].input))
        ^
Error: document not properly dedented, near "\n---"
    at Parser.expect (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:179:9)
    at Parser.parseDoc (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:266:8)
    at Parser.parse (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:232:19)
    at Object.eval (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/node_modules/yaml/lib/yaml.js:384:46)
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:33:26
    at Array.forEach (native)
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:16:13
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:79:29
    at /Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:79:29
    at Object.oncomplete (/Users/dherman/Sources/tc39-codex-wiki/node_modules/codex/lib/codex/plugins/pages.js:85:27)

Dave

Owner

logicalparadox commented Jul 20, 2012

This is the default yaml module error. Will surround it with a try/catch so it can report which markdown file it is referring to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment