Show liquid warnings.
This commit is contained in:
parent
1be51f963b
commit
8d4ab9366e
|
@ -114,16 +114,16 @@ module Jekyll
|
|||
#
|
||||
# Returns the converted content
|
||||
def render_liquid(content, payload, info, path)
|
||||
site.liquid_renderer.file(path).parse(content).render!(payload, info)
|
||||
rescue Tags::IncludeTagError => e
|
||||
Jekyll.logger.error(
|
||||
"Liquid Exception:",
|
||||
"#{e.message} in #{e.path}, included in #{path || self.path}"
|
||||
)
|
||||
raise e
|
||||
template = site.liquid_renderer.file(path).parse(content)
|
||||
template.warnings.each do |e|
|
||||
Jekyll.logger.warn "Liquid Warning:",
|
||||
LiquidRenderer.format_error(e, path || self.path)
|
||||
end
|
||||
template.render!(payload, info)
|
||||
# rubocop: disable RescueException
|
||||
rescue Exception => e
|
||||
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"
|
||||
Jekyll.logger.error "Liquid Exception:",
|
||||
LiquidRenderer.format_error(e, path || self.path)
|
||||
raise e
|
||||
end
|
||||
# rubocop: enable RescueException
|
||||
|
|
|
@ -39,5 +39,12 @@ module Jekyll
|
|||
def stats_table(n = 50)
|
||||
LiquidRenderer::Table.new(@stats).to_s(n)
|
||||
end
|
||||
|
||||
def self.format_error(e, path)
|
||||
if e.is_a? Tags::IncludeTagError
|
||||
return "#{e.message} in #{e.path}, included in #{path}"
|
||||
end
|
||||
"#{e.message} in #{path}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,6 +30,10 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
def warnings
|
||||
@template.warnings
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def measure_bytes
|
||||
|
|
|
@ -106,15 +106,16 @@ module Jekyll
|
|||
#
|
||||
# Returns the content, rendered by Liquid.
|
||||
def render_liquid(content, payload, info, path = nil)
|
||||
site.liquid_renderer.file(path).parse(content).render!(payload, info)
|
||||
rescue Tags::IncludeTagError => e
|
||||
Jekyll.logger.error "Liquid Exception:",
|
||||
"#{e.message} in #{e.path}, included in #{path || document.relative_path}"
|
||||
raise e
|
||||
template = site.liquid_renderer.file(path).parse(content)
|
||||
template.warnings.each do |e|
|
||||
Jekyll.logger.warn "Liquid Warning:",
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
end
|
||||
template.render!(payload, info)
|
||||
# rubocop: disable RescueException
|
||||
rescue Exception => e
|
||||
Jekyll.logger.error "Liquid Exception:",
|
||||
"#{e.message} in #{path || document.relative_path}"
|
||||
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||
raise e
|
||||
end
|
||||
# rubocop: enable RescueException
|
||||
|
|
Loading…
Reference in New Issue