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

Improve error message on creating new content with blank archetype #1279

Closed
Clam- opened this Issue Jul 17, 2015 · 8 comments

Comments

Projects
None yet
4 participants
@Clam-
Copy link
Contributor

Clam- commented Jul 17, 2015

When attempting to create new content with a template that has a empty archetype/default.md file (for example: https://github.com/tanksuzuki/angels-ladder/blob/master/archetypes/default.md ) the following error is displayed:

$ hugo new post/test.md
ERROR: 2015/07/17 Error processing archetype file: hugo-dir/themes/angels-ladder/archetypes/default.md
ERROR: 2015/07/17 Unable to Cast <nil> to map[string]interface{}

I think either a blank file should be ignored (as many templates seem to use them) or a more descriptive error should be displayed.

@bep

This comment has been minimized.

Copy link
Member

bep commented Jul 17, 2015

If many templates use empty archetype files, then that is the problem that should be addressed first.

@Clam-

This comment has been minimized.

Copy link
Contributor

Clam- commented Jul 17, 2015

Hmm, you think so? There's at least 5 templates in the hugoThemes repo that have this empty default.md file. What do you mean by addressing it first?
Even if we eliminated all the templates with blank files, if that's what you are suggesting; if someone was to stumble across that error in the future it would be pretty cryptic for them to solve it.
I really think adding a human understandable error message would be the best course of action. It solves all current and future instances of this problem.

@mauzel

This comment has been minimized.

Copy link

mauzel commented Jul 17, 2015

I think the problem that should be addressed first is having sensible error messages with a clear specification of what inputs (in this case: non-empty archetypes) the hugo binary expects.

This would eliminate all future instances of theme authors writing broken themes. Once that is clarified with a clear specification of acceptable inputs to the hugo binary, the theme writers can be convinced to update their theme repos with fixes.

It is likely that most Hugo users aren't programmers themselves, so non-descript error messages (which in this case, are basically akin to the dread NPE or segfault due to a nullpo reference) may confuse and irritate new Hugo users.

@bep

This comment has been minimized.

Copy link
Member

bep commented Jul 17, 2015

By addressing first I mean: Fix or remove the broken archetypes in the hugoThemes. Open up pull request for each of them.

If at all possible, fix the cause of the error. In this case it is possible.

And a better error message would be welcomed, too. But spending lot of time on very rare error cases doesn't make much sense to me.

@bep bep changed the title Bad error message on creating new content with blank archetype Improve error message on creating new content with blank archetype Jul 17, 2015

@bep

This comment has been minimized.

Copy link
Member

bep commented Jun 11, 2016

Closing as stale.

@anthonyfok

This comment has been minimized.

Copy link
Contributor

anthonyfok commented Jul 7, 2016

See also #315 and #2258

@anthonyfok anthonyfok added this to the v0.17 milestone Jul 7, 2016

@anthonyfok anthonyfok reopened this Jul 7, 2016

zgulde added a commit to zgulde/hugo-remark that referenced this issue Sep 16, 2016

remove default archetype file
in newer versions of hugo a blank default archetype file will throw
[cryptic error messages](gohugoio/hugo#1279)

@bep bep modified the milestones: future, v0.17 Sep 16, 2016

@bep bep added the Stale label Feb 28, 2017

@bep

This comment has been minimized.

Copy link
Member

bep commented Feb 28, 2017

This issue has been automatically marked as stale because it has not been commented on for at least four months.

The resources of the Hugo team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.

This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.

@bep

This comment has been minimized.

Copy link
Member

bep commented Mar 1, 2017

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

@bep bep closed this Apr 9, 2017

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