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

Already on GitHub? Sign in to your account

Missing include file error should specificy where include is called from, not target #1745

Closed
benbalter opened this Issue Nov 21, 2013 · 5 comments

Comments

Projects
None yet
4 participants
Contributor

benbalter commented Nov 21, 2013

If I make an include tag call to a missing file, the error should point me to the source of the missing include, not tell me where the include should be twice.

Steps to reproduce

Make a new site and add {% include missing-file.html %} to index.html

Expected

Liquid Exception: Included file 'missing-file.html' not found in '_includes' directory in index.html

Actual

Liquid Exception: Included file 'missing-file.html' not found in '_includes' directory in _includes/missing-file.html

Owner

parkr commented Nov 21, 2013

Thanks for the detailed bug report! Will look into this further.

Contributor

maul-esel commented Nov 21, 2013

It references _includes/missing-file.html because for other errors, especially due to liquid syntax errors in the included file, it is much more useful to direct users to that file; and jekyll currently doesn't separate between such errors and the missing file error.

However, the path of the file of the tag is already present in the relevant method, so we could output both, like

Liquid Exception: Included file 'missing-file.html' not found in '_includes' directory in _includes/missing-file.html, included in index.html

or similar.

The relevant code is in https://github.com/mojombo/jekyll/blob/master/lib/jekyll/convertible.rb#L90.

Owner

parkr commented Nov 21, 2013

@maul-esel Want to take a stab at that?

Contributor

maul-esel commented Nov 21, 2013

Already on it :)

@maul-esel maul-esel added a commit to maul-esel/jekyll that referenced this issue Nov 22, 2013

@maul-esel maul-esel restrict rescue-clause in IncludeTag#render
As it previously enclosed the whole method, it also
wrapped file validation errors, which is not meant to be.

Fixes #1745.
c5533e9
Contributor

maul-esel commented Nov 22, 2013

jekyll currently doesn't separate between such errors and the missing file error.

That was actually wrong. It does separate, but due to an incorrect rescue clause, it wraps the latter kind in the first kind. This should be fixed in the PR referenced above.

@mattr- mattr- closed this in #1746 Nov 23, 2013

@csim csim added a commit to csim/jekyll that referenced this issue Nov 24, 2013

@maul-esel @csim maul-esel + csim restrict rescue-clause in IncludeTag#render
As it previously enclosed the whole method, it also
wrapped file validation errors, which is not meant to be.

Fixes #1745.
b27a6a4

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017

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