Merge pull request #5129 from stevecheckoway/display-liquid-warnings
Merge pull request 5129
This commit is contained in:
commit
810e411bdf
|
@ -114,16 +114,16 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the converted content
|
# Returns the converted content
|
||||||
def render_liquid(content, payload, info, path)
|
def render_liquid(content, payload, info, path)
|
||||||
site.liquid_renderer.file(path).parse(content).render!(payload, info)
|
template = site.liquid_renderer.file(path).parse(content)
|
||||||
rescue Tags::IncludeTagError => e
|
template.warnings.each do |e|
|
||||||
Jekyll.logger.error(
|
Jekyll.logger.warn "Liquid Warning:",
|
||||||
"Liquid Exception:",
|
LiquidRenderer.format_error(e, path || self.path)
|
||||||
"#{e.message} in #{e.path}, included in #{path || self.path}"
|
end
|
||||||
)
|
template.render!(payload, info)
|
||||||
raise e
|
|
||||||
# rubocop: disable RescueException
|
# rubocop: disable RescueException
|
||||||
rescue Exception => e
|
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
|
raise e
|
||||||
end
|
end
|
||||||
# rubocop: enable RescueException
|
# rubocop: enable RescueException
|
||||||
|
|
|
@ -39,5 +39,12 @@ module Jekyll
|
||||||
def stats_table(n = 50)
|
def stats_table(n = 50)
|
||||||
LiquidRenderer::Table.new(@stats).to_s(n)
|
LiquidRenderer::Table.new(@stats).to_s(n)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,10 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def warnings
|
||||||
|
@template.warnings
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def measure_bytes
|
def measure_bytes
|
||||||
|
|
|
@ -106,15 +106,16 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the content, rendered by Liquid.
|
# Returns the content, rendered by Liquid.
|
||||||
def render_liquid(content, payload, info, path = nil)
|
def render_liquid(content, payload, info, path = nil)
|
||||||
site.liquid_renderer.file(path).parse(content).render!(payload, info)
|
template = site.liquid_renderer.file(path).parse(content)
|
||||||
rescue Tags::IncludeTagError => e
|
template.warnings.each do |e|
|
||||||
Jekyll.logger.error "Liquid Exception:",
|
Jekyll.logger.warn "Liquid Warning:",
|
||||||
"#{e.message} in #{e.path}, included in #{path || document.relative_path}"
|
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||||
raise e
|
end
|
||||||
|
template.render!(payload, info)
|
||||||
# rubocop: disable RescueException
|
# rubocop: disable RescueException
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
Jekyll.logger.error "Liquid Exception:",
|
Jekyll.logger.error "Liquid Exception:",
|
||||||
"#{e.message} in #{path || document.relative_path}"
|
LiquidRenderer.format_error(e, path || document.relative_path)
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
# rubocop: enable RescueException
|
# rubocop: enable RescueException
|
||||||
|
|
Loading…
Reference in New Issue