Merge pull request #2649 from alfredxing/friendly-date-error
This commit is contained in:
commit
e75dc74bb1
|
@ -61,7 +61,14 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.key?('date')
|
if data.key?('date')
|
||||||
self.date = Time.parse(data["date"].to_s)
|
begin
|
||||||
|
self.date = Time.parse(data["date"].to_s)
|
||||||
|
rescue ArgumentError
|
||||||
|
path = File.join(@dir || "", name)
|
||||||
|
msg = "Post '#{relative_path}' does not have a valid date in the YAML front matter.\n"
|
||||||
|
msg << "Fix the date, or exclude the file or directory from being processed"
|
||||||
|
raise Errors::FatalException.new(msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
populate_categories
|
populate_categories
|
||||||
|
@ -166,7 +173,7 @@ module Jekyll
|
||||||
self.ext = ext
|
self.ext = ext
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
path = File.join(@dir || "", name)
|
path = File.join(@dir || "", name)
|
||||||
msg = "Post '#{path}' does not have a valid date.\n"
|
msg = "Post '#{relative_path}' does not have a valid date.\n"
|
||||||
msg << "Fix the date, or exclude the file or directory from being processed"
|
msg << "Fix the date, or exclude the file or directory from being processed"
|
||||||
raise Errors::FatalException.new(msg)
|
raise Errors::FatalException.new(msg)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue