Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Catch Liquid template exceptions, and write out their details. Preven…

…ts silent fail of template parsing
  • Loading branch information...
commit 0a58d78338488531aafeebcd5e35e1a5cf3eadd6 1 parent 31901ee
@MattHall MattHall authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/jekyll/convertible.rb
View
15 lib/jekyll/convertible.rb
@@ -63,7 +63,13 @@ def do_layout(payload, layouts)
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
- self.content = Liquid::Template.parse(self.content).render(payload, info)
+
+ begin
+ self.content = Liquid::Template.parse(self.content).render(payload, info)
+ rescue => e
+ puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
+ end
+
self.transform
# output keeps track of what will finally be written
@@ -73,7 +79,12 @@ def do_layout(payload, layouts)
layout = layouts[self.data["layout"]]
while layout
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
- self.output = Liquid::Template.parse(layout.content).render(payload, info)
+
+ begin
+ self.output = Liquid::Template.parse(layout.content).render(payload, info)
+ rescue => e
+ puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
+ end
layout = layouts[layout.data["layout"]]
end
Please sign in to comment.
Something went wrong with that request. Please try again.