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:
parent
0522f10fa8
commit
5a91dce044
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue