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)
|
||||
end
|
||||
|
||||
YAML_ERRORS = [ Exception, ArgumentError ]
|
||||
|
||||
if defined?(Psych) && defined?(Psych::SyntaxError)
|
||||
YAML_ERRORS << Psych::SyntaxError
|
||||
end
|
||||
|
||||
# Parse YAML frontmatter out of a string
|
||||
# @param [String] content
|
||||
# @return [Array<Hash, String>]
|
||||
|
@ -77,7 +83,7 @@ module Middleman::CoreExtensions
|
|||
|
||||
begin
|
||||
data = YAML.load($1)
|
||||
rescue => e
|
||||
rescue *YAML_ERRORS => e
|
||||
puts "YAML Exception: #{e.message}"
|
||||
return false
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue