Catch Psych::SyntaxError. Related to #446
This commit is contained in:
parent
bb659bb5be
commit
182ad87ad3
1 changed files with 7 additions and 1 deletions
|
@ -67,6 +67,12 @@ module Middleman::CoreExtensions
|
||||||
@cache.delete(path)
|
@cache.delete(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
YAML_ERRORS = [ Exception, ArgumentError ]
|
||||||
|
|
||||||
|
if defined?(Psych) && defined?(Psych::SyntaxError)
|
||||||
|
YAML_ERRORS << Psych::SyntaxError
|
||||||
|
end
|
||||||
|
|
||||||
# Parse YAML frontmatter out of a string
|
# Parse YAML frontmatter out of a string
|
||||||
# @param [String] content
|
# @param [String] content
|
||||||
# @return [Array<Hash, String>]
|
# @return [Array<Hash, String>]
|
||||||
|
@ -77,7 +83,7 @@ module Middleman::CoreExtensions
|
||||||
|
|
||||||
begin
|
begin
|
||||||
data = YAML.load($1)
|
data = YAML.load($1)
|
||||||
rescue => e
|
rescue *YAML_ERRORS => e
|
||||||
puts "YAML Exception: #{e.message}"
|
puts "YAML Exception: #{e.message}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue