Skip to content

Commit ff69d3f

Browse files
danielfoneplusjade
authored andcommitted
Better exception handling
You probably only want to rescue `ArgumentError` here, but certainly nothing more than the default `StandardError`. Rescuing `Exception` can lead to very strange behaviour. See: http://www.mikeperham.com/2012/03/03/the-perils-of-rescue-exception/ http://stackoverflow.com/a/10048406/1848
1 parent 0766ee2 commit ff69d3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ task :post do
4949
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
5050
begin
5151
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')
52-
rescue Exception => e
52+
rescue => e
5353
puts "Error - date format must be YYYY-MM-DD, please check you typed it correctly!"
5454
exit -1
5555
end

0 commit comments

Comments
 (0)