Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in frontmatter parsing lead to hard-to-diagnose bugs #157

Open
markjaquith opened this issue Jun 30, 2022 · 1 comment
Open

Errors in frontmatter parsing lead to hard-to-diagnose bugs #157

markjaquith opened this issue Jun 30, 2022 · 1 comment

Comments

@markjaquith
Copy link
Contributor

I had some tags in my frontmatter like this:

---
draft: true
title: My Title
excerpt: My Excerpt
date: 2022-06-22
tags:
  - One
	- Two
---

Since my editor shows tabs as two spaces, I didn't notice that Two was tab-indented.

The way this presents when building will depend on your setup, but for me it was:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'draft' of undefined
at /Users/mark/Sites/example/node_modules/@elderjs/plugin-markdown/index.js:131:32

But my custom slug formatter also uses frontmatter, so before I made the accessing of frontmatter there safe, it was erroring in there.

I think the markdown plugin should detect when frontmatter parsing has resulted in undefined, as otherwise spooky things are gonna happen downstream.

@nickreese
Copy link
Contributor

Let's revisit this once the typescript branch is shipped. There was a ton of issues with the unified ecosystem I had to slog through. Hopefully we can add something to make these errors better now that their chaos is behind us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants