[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master cf0c022 02/13: Add conditional debugging code
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master cf0c022 02/13: Add conditional debugging code |
Date: |
Sat, 15 Jun 2019 20:25:35 -0400 (EDT) |
branch: master
commit cf0c02252d4f605812559661bc7ce6d4a60eb059
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add conditional debugging code
This commit may be reverted someday. For now, it's sometimes handy.
---
basic_tables.cpp | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/basic_tables.cpp b/basic_tables.cpp
index 150cd70..8a0f4c0 100644
--- a/basic_tables.cpp
+++ b/basic_tables.cpp
@@ -30,6 +30,11 @@
#include "oecumenic_enumerations.hpp"
#include "product_data.hpp"
+#if 0 // For debugging only.
+#include "alert.hpp"
+#include "handle_exceptions.hpp"
+#endif // 0
+
#include <string>
namespace
@@ -43,12 +48,44 @@ std::vector<double> basic_table_rates
,int years_to_maturity
)
{
+#if 1
return actuarial_table_rates
(AddDataDir(product.datum(table_name))
,database.query<int>(table_id)
,issue_age
,years_to_maturity
);
+#else // For debugging only. "Unsuitable for production" as explained below.
+ std::string const f = AddDataDir(product.datum(table_name));
+ int const t = database.query<int>(table_id);
+ try
+ {
+ return actuarial_table_rates(f, t, issue_age, years_to_maturity);
+ }
+ catch(...)
+ {
+ report_exception();
+ if(0 == t)
+ {
+ warning() << "Table number zero is always invalid." << LMI_FLUSH;
+ }
+ else
+ {
+ actuarial_table const a(f, t);
+ warning()
+ << "'" << f << "' rate-table database\n"
+ << t << " table number\n"
+ << issue_age << " issue_age argument\n"
+ << years_to_maturity << " years_to_maturity argument\n"
+ << a.min_age() << " table minimum age\n"
+ << a.max_age() << " table maximum age\n"
+ << LMI_FLUSH
+ ;
+ }
+ // Unsuitable for production, which must throw instead.
+ return std::vector<double>(years_to_maturity);
+ }
+#endif // 0
}
} // Unnamed namespace
- [lmi-commits] [lmi] master updated (5fce601 -> e019e5b), Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master db9783b 01/13: Document some ideas for future improvements, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 2f9030d 04/13: Improve documentation, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master cf0c022 02/13: Add conditional debugging code,
Greg Chicares <=
- [lmi-commits] [lmi] master 5fcaa33 05/13: Move a line; add a comment, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 1fa08b4 08/13: Make 'AgentPhone' a "required" input field, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master d08aabe 10/13: Reapply "Move imprimaturs; rearrange footer", Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 6170caf 12/13: Add agent Id and phone to cover page, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 48ffe2c 03/13: Optionally get 7702 q from built-in table, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 0ea441a 07/13: Verify both DB_Irc7702QWhence cases, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master d07c63a 06/13: Conditionalize a block, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master b72c0eb 09/13: Make agent's Id and phone number available for reports, Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master 38ce843 11/13: Simplify formatting of 'imprimatur', Greg Chicares, 2019/06/15
- [lmi-commits] [lmi] master e019e5b 13/13: Rework some finra MST files, Greg Chicares, 2019/06/15