7198, 7212: attach invalid date to DateError

when Date.set throws during the date fields sanity
check validation, it now attaches an (undocumented) .date field
to the exception -- proof of concept for 7198 and potentially
for 7212 as well
This commit is contained in:
Vassilii Khachaturov 2013-11-16 17:51:18 +02:00
parent a3749090aa
commit 8e16599940

View File

@ -1673,9 +1673,10 @@ class Date(object):
raise DateError("Invalid year {} passed in value {}". raise DateError("Invalid year {} passed in value {}".
format(original, value)) format(original, value))
except DateError: except DateError as e:
log.debug("Sanity check failed - self: {}, sanity: {}".format( log.debug("Sanity check failed - self: {}, sanity: {}".format(
self.to_struct(), sanity.to_struct())) self.to_struct(), sanity.to_struct()))
e.date = self
raise raise
def recalc_sort_value(self): def recalc_sort_value(self):