From 3888a240689b6c15a7b40f25c8aebd1d4ddfdf31 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Thu, 21 Nov 2013 22:03:39 +0100 Subject: [PATCH 1/2] output including file for include tag error --- lib/jekyll/convertible.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 01ed0743..723b0da7 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -87,7 +87,7 @@ module Jekyll def render_liquid(content, payload, info, path = nil) Liquid::Template.parse(content).render!(payload, info) rescue Tags::IncludeTagError => e - Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}" + Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || self.path}" raise e rescue Exception => e Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}" From c5533e9016b83c2370bed430edc547867ee5c7e6 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Fri, 22 Nov 2013 06:58:52 +0100 Subject: [PATCH 2/2] 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. --- lib/jekyll/tags/include.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index 15f99507..ee1636c7 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -96,14 +96,16 @@ eos path = File.join(dir, file) validate_file(path, context.registers[:site].safe) - partial = Liquid::Template.parse(source(path, context)) + begin + partial = Liquid::Template.parse(source(path, context)) - context.stack do - context['include'] = parse_params(context) if @params - partial.render!(context) + context.stack do + context['include'] = parse_params(context) if @params + partial.render!(context) + end + rescue => e + raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end - rescue => e - raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end def validate_dir(dir, safe)