From 22017d085b0780e9bc17dff077ba2c9cc25e0ad4 Mon Sep 17 00:00:00 2001 From: schneems Date: Wed, 18 Dec 2013 14:55:15 -0600 Subject: [PATCH] Better error message when time is not parseable Give the full path of the file that cannot be parsed so the user can locate it easier. Follow up the error message with helpful instructions: they can resolve the error by fixing the date or excluding the file or directory from being processed. --- lib/jekyll/post.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index da64af93..17f4757f 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -160,7 +160,10 @@ module Jekyll self.slug = slug self.ext = ext rescue ArgumentError - raise FatalException.new("Post #{name} does not have a valid date.") + path = File.join(@dir || "", name) + msg = "Post '#{path}' does not have a valid date.\n" + msg << "Fix the date, or exclude the file or directory from being processed" + raise FatalException.new(msg) end # The generated directory into which the post will be placed