Better error message for invalid post date.
This commit is contained in:
parent
6c94db1486
commit
dce4ccc5a4
|
@ -7,6 +7,8 @@
|
|||
* Use English library to avoid hoops (#292)
|
||||
* Add Posterous importer (#254)
|
||||
* Fixes for Wordpress importer (#274, #252, #271)
|
||||
* Better error message for invalid post date (#291)
|
||||
* Print formatted fatal exceptions to stdout on build failure
|
||||
* Bug Fixes
|
||||
* Secure additional path exploits
|
||||
|
||||
|
|
|
@ -242,7 +242,11 @@ else
|
|||
puts "Building site: #{source} -> #{destination}"
|
||||
begin
|
||||
site.process
|
||||
rescue Jekyll::FatalException
|
||||
rescue Jekyll::FatalException => e
|
||||
puts
|
||||
puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
|
||||
puts "------------------------------------"
|
||||
puts e.message
|
||||
exit(1)
|
||||
end
|
||||
puts "Successfully generated site: #{source} -> #{destination}"
|
||||
|
|
|
@ -78,6 +78,8 @@ module Jekyll
|
|||
self.date = Time.parse(date)
|
||||
self.slug = slug
|
||||
self.ext = ext
|
||||
rescue ArgumentError
|
||||
raise FatalException.new("Post #{name} does not have a valid date.")
|
||||
end
|
||||
|
||||
# The generated directory into which the post will be placed
|
||||
|
|
|
@ -52,6 +52,12 @@ class TestPost < Test::Unit::TestCase
|
|||
assert_equal "/2008/09/09/foo-bar.html", @post.url
|
||||
end
|
||||
|
||||
should "raise a good error on invalid post date" do
|
||||
assert_raise Jekyll::FatalException do
|
||||
@post.process("2009-27-03-foo-bar.textile")
|
||||
end
|
||||
end
|
||||
|
||||
should "CGI escape urls" do
|
||||
@post.categories = []
|
||||
@post.process("2009-03-12-hash-#1.markdown")
|
||||
|
|
Loading…
Reference in New Issue