From 597792c98861853d131f7042cc9809fbfa95ff18 Mon Sep 17 00:00:00 2001 From: Vincent Durand Date: Thu, 22 Sep 2016 19:02:42 +0200 Subject: [PATCH] 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`. --- lib/quote.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/quote.rb b/lib/quote.rb index ddc00ca..8490d7d 100644 --- a/lib/quote.rb +++ b/lib/quote.rb @@ -35,7 +35,7 @@ class Quote raise Invalid, 'Date too old' unless current_date @date = current_date rescue Sequel::DatabaseError => ex - if ex.wrapped_exception.is_a?(PG::DatetimeFieldOverflow) + if ex.wrapped_exception.is_a?(PG::DataException) raise Invalid, 'Invalid date' else raise