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

Posts with invalid dates result in unhelpful error messages #4375

Closed
benbalter opened this Issue Jan 19, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@benbalter
Contributor

benbalter commented Jan 19, 2016

Steps to reproduce:

  1. In an empty folder, create a _posts subdirectory, an add 2016-01-01-test.md
  2. In that post, add an invalid date in the YAML front matter, e.g., date: tuesday
  3. jekyll build

Expected

Site would yell at me, but still builds

Actual

  • jekyll 3.0.1 | Error: undefined methodeach' for nil:NilClass`
  • jekyll 3.1.0.pre.rc2 | Error: undefined methodstrftime' for "invalid-date":String`

The same is true of other non-date values.

@benbalter benbalter added the Bug label Jan 19, 2016

@parkr parkr self-assigned this Jan 19, 2016

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 19, 2016

Member

Site would yell at me, but still builds

I'm not sure it should build – we generally like to make things error out entirely. This message is sadly quite unhelpful but we could tidy it up. I am of the opinion that failing loudly is better here than letting the build succeed.

Member

parkr commented Jan 19, 2016

Site would yell at me, but still builds

I'm not sure it should build – we generally like to make things error out entirely. This message is sadly quite unhelpful but we could tidy it up. I am of the opinion that failing loudly is better here than letting the build succeed.

@benbalter benbalter changed the title from Build fails if any post has an invalid date to Posts with invalid dates result in unhelpful error messages Jan 19, 2016

@benbalter

This comment has been minimized.

Show comment
Hide comment
@benbalter

benbalter Jan 19, 2016

Contributor

To note, the same also happens with a post of _posts/2016-25-35-test.md.

You're right, it should be an error, not a warning. That was also the behavior pre-3.0, which responded with:

  • /Post '_posts\/(.*\d+-\d+-\d+-.*)' does not have a valid date in the YAML front matter./
  • /Post '_posts\/(.*\d+-\d+-\d+-.*)' does not have a valid date in the filename./

Edit Renamed the issue to properly represent the problem based on pre 3.0 behavior.

Edit2: swapped error for warning.

Contributor

benbalter commented Jan 19, 2016

To note, the same also happens with a post of _posts/2016-25-35-test.md.

You're right, it should be an error, not a warning. That was also the behavior pre-3.0, which responded with:

  • /Post '_posts\/(.*\d+-\d+-\d+-.*)' does not have a valid date in the YAML front matter./
  • /Post '_posts\/(.*\d+-\d+-\d+-.*)' does not have a valid date in the filename./

Edit Renamed the issue to properly represent the problem based on pre 3.0 behavior.

Edit2: swapped error for warning.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 19, 2016

Member

@benbalter I'll fix this up and publish a v3.0.2 with any other bugs you may find. Hoping to have v3.1.0 out the door this week, too.

Member

parkr commented Jan 19, 2016

@benbalter I'll fix this up and publish a v3.0.2 with any other bugs you may find. Hoping to have v3.1.0 out the door this week, too.

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Jan 19, 2016

Contributor

What happens when somebody messes up the date, doesn't notice the warning because it let it built, publishes their site to Github, or otherwise, messes up their SEO, and comes and blames us because we didn't throw like we should? The principle of all good programming is to throw, that's no different than an app, the difference is that instead of throwing with a trace we throw a message at them and refuse the built.

Contributor

envygeeks commented Jan 19, 2016

What happens when somebody messes up the date, doesn't notice the warning because it let it built, publishes their site to Github, or otherwise, messes up their SEO, and comes and blames us because we didn't throw like we should? The principle of all good programming is to throw, that's no different than an app, the difference is that instead of throwing with a trace we throw a message at them and refuse the built.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jan 19, 2016

Member

You're right, it should be a warning, not an error.

I mean to say that it should be an error, not that it should just warn. The first sentence of my comment was a little confusing!

Member

parkr commented Jan 19, 2016

You're right, it should be a warning, not an error.

I mean to say that it should be an error, not that it should just warn. The first sentence of my comment was a little confusing!

@parkr parkr added this to the 3.0.2 milestone Jan 19, 2016

@benbalter

This comment has been minimized.

Show comment
Hide comment
@benbalter

benbalter Jan 19, 2016

Contributor

I mean to say that it should be an error, not that it should just warn. The first sentence of my comment was a little confusing!

Nah, I knew what you meant. I just swapped 'em in my head. Updated my comment. I agree with you. Errors all around.

Contributor

benbalter commented Jan 19, 2016

I mean to say that it should be an error, not that it should just warn. The first sentence of my comment was a little confusing!

Nah, I knew what you meant. I just swapped 'em in my head. Updated my comment. I agree with you. Errors all around.

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