Rescue exception when parsing invalid yaml. Prevents silent fail in auto and server mode

This commit is contained in:
MattHall 2010-12-11 14:30:44 +00:00
parent 0a58d78338
commit 226c7cc121
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ module Jekyll
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = self.content[($1.size + $2.size)..-1]
self.data = YAML.load($1)
begin
self.data = YAML.load($1)
rescue => e
puts "YAML Exception: #{e.message}"
end
end
self.data ||= {}