Update rescued exception

The converter API allows the date as parameter and it needs to be
rescued with an invalid date, and the exception is
`PG::InvalidDatetimeFormat`, so the safest solution was to use the
first ancestor of this exception which is the same one as the current
`PG::DatetimeFieldOverflow`.
This commit is contained in:
Vincent Durand 2016-09-22 19:02:42 +02:00
parent ad64574745
commit 597792c988

View File

@ -35,7 +35,7 @@ class Quote
raise Invalid, 'Date too old' unless current_date raise Invalid, 'Date too old' unless current_date
@date = current_date @date = current_date
rescue Sequel::DatabaseError => ex rescue Sequel::DatabaseError => ex
if ex.wrapped_exception.is_a?(PG::DatetimeFieldOverflow) if ex.wrapped_exception.is_a?(PG::DataException)
raise Invalid, 'Invalid date' raise Invalid, 'Invalid date'
else else
raise raise