[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master d28f769 7/9: Improve certain error messages
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master d28f769 7/9: Improve certain error messages |
Date: |
Thu, 12 Jul 2018 13:12:58 -0400 (EDT) |
branch: master
commit d28f769b6231fe9eb459d8d0281a30a77f314049
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve certain error messages
years_and_months_since() throws an exception if its second argument
precedes its first. That's appropriate, but the error message may
confuse end users. Therefore, added explicit tests that display more
helpful messages before calls to years_and_months_since().
Rewrote the off-monthiversary error message to make it clearer and
more informative, explicitly explaining that inforce values as of one
date don't equal inforce values as of a different date.
---
input_harmonization.cpp | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index 32228e2..62661e3 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -1091,6 +1091,18 @@ void Input::set_solve_durations()
void Input::set_inforce_durations_from_dates(std::ostream& os)
{
+ if(InforceAsOfDate.value() < EffectiveDate.value())
+ {
+ os
+ << "Input inforce-as-of date, "
+ << InforceAsOfDate.value().str()
+ << ", precedes the "
+ << EffectiveDate.value().str()
+ << " effective date."
+ << LMI_FLUSH
+ ;
+ }
+
std::pair<int,int> ym0 = years_and_months_since
(EffectiveDate .value()
,InforceAsOfDate.value()
@@ -1099,6 +1111,20 @@ void
Input::set_inforce_durations_from_dates(std::ostream& os)
InforceYear = ym0.first;
InforceMonth = ym0.second;
+ if(InforceAsOfDate.value() < LastMaterialChangeDate.value())
+ {
+ os
+ << "Input inforce-as-of date, "
+ << InforceAsOfDate.value().str()
+ << ", precedes the "
+ << LastMaterialChangeDate.value().str()
+ << " last material change date."
+ << LMI_FLUSH
+ ;
+ }
+ // Somewhat dubiously, force the issue.
+ LastMaterialChangeDate = std::min(LastMaterialChangeDate, InforceAsOfDate);
+
std::pair<int,int> ym1 = years_and_months_since
(LastMaterialChangeDate.value()
,InforceAsOfDate .value()
@@ -1119,7 +1145,7 @@ void
Input::set_inforce_durations_from_dates(std::ostream& os)
<< "Input inforce-as-of date, "
<< InforceAsOfDate.value().str()
<< ", is not an exact monthiversary date."
- << "\nIt must change to "
+ << "\nIt would be interpreted as "
<< expected.str()
<< ", which is "
<< InforceYear
@@ -1128,11 +1154,11 @@ void
Input::set_inforce_durations_from_dates(std::ostream& os)
<< " full months"
<< "\nafter the "
<< EffectiveDate.value().str()
- << " effective date."
+ << " effective date, but inforce values as of that date"
+ << " would be different."
<< LMI_FLUSH
;
InforceAsOfDate = expected;
- LastMaterialChangeDate = std::min(LastMaterialChangeDate,
InforceAsOfDate);
}
if
- [lmi-commits] [lmi] master updated (f5c7c0b -> 34bd9e1), Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master 8c11196 1/9: Work around a compiler warning, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master 899a163 3/9: Improve documentation, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master 8a68504 4/9: Call Reconcile() when reading all external input files, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master c28ef2c 5/9: Demonstrate substitutability of alert streams, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master 34bd9e1 9/9: Designate release candidate 20180712T1708Z, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master ed63bee 2/9: Enable GUI test to preserve 'configurable_settings.xml', Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master 2a0823a 8/9: Throw an exception if schema validation fails, Greg Chicares, 2018/07/12
- [lmi-commits] [lmi] master d28f769 7/9: Improve certain error messages,
Greg Chicares <=
- [lmi-commits] [lmi] master 7aaa73e 6/9: Validate external input more stringently, Greg Chicares, 2018/07/12