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

Emit on parse error #37

Closed
ArmorDarks opened this issue Mar 3, 2017 · 4 comments
Closed

Emit on parse error #37

ArmorDarks opened this issue Mar 3, 2017 · 4 comments

Comments

@ArmorDarks
Copy link

So far if Gray Matter encounters Matter block, but unable to parse it (let's say, due to wrong escaping), it silently ignores it and outputs empty file.

It would be much better if Gray Matter instead emitted some event, so we can hook on it and log warning about invalid syntax, etc.

@jonschlinkert
Copy link
Owner

I agree, we need to completely refactor how the parsers work. I'll try to spend some time on this as soon as I have a chance

@ArmorDarks
Copy link
Author

Well, for YAML js-yaml already should throw an error if it encounters syntax error. However, gray-matter seems to swallowing that error somewhere.

If it could be passed as a callback (error) => do something with me, it would solve the issue.

Another way would be a simple option like opts.throwOnParseError, which will force exception in case of parsing error.

@jonschlinkert
Copy link
Owner

this was resolved in 3.0

@ArmorDarks
Copy link
Author

Wow, cool! I've totally missed new release. Thanks a lot!

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