Merge pull request #1596 from maul-esel/error-file
Output path in case of liquid error in include file
This commit is contained in:
commit
6abe01f60f
|
@ -86,6 +86,9 @@ module Jekyll
|
|||
# Returns the converted content
|
||||
def render_liquid(content, payload, info)
|
||||
Liquid::Template.parse(content).render!(payload, info)
|
||||
rescue Tags::IncludeTagError => e
|
||||
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}"
|
||||
raise e
|
||||
rescue Exception => e
|
||||
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{self.path}"
|
||||
raise e
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
module Jekyll
|
||||
module Tags
|
||||
class IncludeTagError < StandardError
|
||||
attr_accessor :path
|
||||
|
||||
def initialize(msg, path)
|
||||
super msg
|
||||
@path = path
|
||||
end
|
||||
end
|
||||
|
||||
class IncludeTag < Liquid::Tag
|
||||
|
||||
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
|
||||
|
@ -86,7 +95,11 @@ eos
|
|||
|
||||
context.stack do
|
||||
context['include'] = parse_params(context) if @params
|
||||
partial.render(context)
|
||||
begin
|
||||
partial.render!(context)
|
||||
rescue => e
|
||||
raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue