1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

make time_for always raise an ArgumentError if something goes wrong

This commit is contained in:
Konstantin Haase 2011-04-11 13:13:01 +02:00
parent 0522f10fa8
commit 5a91dce044
2 changed files with 2 additions and 2 deletions

View file

@ -421,7 +421,7 @@ module Sinatra
Time.parse value.to_s
end
rescue ArgumentError => boom
raise boom.to_s
raise boom
rescue Exception
raise ArgumentError, "unable to convert #{value.inspect} to a Time object"
end

View file

@ -679,7 +679,7 @@ class HelpersTest < Test::Unit::TestCase
end
it 'fails when Time.parse raises an ArgumentError' do
assert_raise(RuntimeError) { get '/boom' }
assert_raise(ArgumentError) { get '/boom' }
end
end