[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/004 f16fd3a 02/17: Expunge an unwanted excep
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/004 f16fd3a 02/17: Expunge an unwanted exception class |
Date: |
Thu, 24 Dec 2020 10:23:50 -0500 (EST) |
branch: valyuta/004
commit f16fd3ac2fb605ff8fa795424b3837f0d9b841fd
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Expunge an unwanted exception class
The GPT server has numerous exception classes of its own. Expunged the
"product rule violated" exception, which was unique in that it was used
outside the server's main TU (because the conditions for throwing it
could not readily be detected in that TU). It harmfully obstructed
merging BasicValues::GPTServerInit() into BasicValues::Init().
Left the other special exception classes alone because they're self-
contained and harmless, though overwrought. The original intention was
to catch numerous specific exceptions, translate them to a numeric error
code, and augment their what() messages with unique contract numbers,
for an lmi-based client-server tax system; but no client was ever
finished.
---
Makefile.am | 1 -
ihs_basicval.cpp | 25 ++++++++++++++++---------
ihs_server7702.cpp | 19 +++++++++----------
ihs_x_type.hpp | 39 ---------------------------------------
4 files changed, 25 insertions(+), 59 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 98bfc71..1d7db18 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1349,7 +1349,6 @@ noinst_HEADERS = \
ihs_irc7702.hpp \
ihs_irc7702a.hpp \
ihs_server7702.hpp \
- ihs_x_type.hpp \
illustration_document.hpp \
illustration_view.hpp \
illustrator.hpp \
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 0132ab0..834be37 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -262,7 +262,6 @@ void BasicValues::Init()
}
//============================================================================
-#include "ihs_x_type.hpp" // x_product_rule_violated TAXATION !!
remove later
// TODO ?? Not for general use--use for GPT server only, for now. TAXATION !!
refactor later
void BasicValues::GPTServerInit()
{
@@ -298,17 +297,25 @@ void BasicValues::GPTServerInit()
if(IssueAge < database().query<int>(DB_MinIssAge))
{
- throw x_product_rule_violated
- (
- std::string("Issue age less than minimum")
- );
+ alarum()
+ << "Issue age "
+ << IssueAge
+ << " less than minimum "
+ << database().query<int>(DB_MinIssAge)
+ << '.'
+ << LMI_FLUSH
+ ;
}
if(database().query<int>(DB_MaxIssAge) < IssueAge)
{
- throw x_product_rule_violated
- (
- std::string("Issue age greater than maximum")
- );
+ alarum()
+ << "Issue age "
+ << IssueAge
+ << " greater than maximum "
+ << database().query<int>(DB_MaxIssAge)
+ << '.'
+ << LMI_FLUSH
+ ;
}
// lingo_.reset(new lingo(AddDataDir(product().datum("LingoFilename"))));
// FundData_.reset(new FundData(AddDataDir(product().datum("FundFilename"))));
diff --git a/ihs_server7702.cpp b/ihs_server7702.cpp
index ebfd64b..e1ce60a 100644
--- a/ihs_server7702.cpp
+++ b/ihs_server7702.cpp
@@ -32,7 +32,6 @@
#include "fenv_lmi.hpp"
#include "gpt_input.hpp"
#include "ihs_irc7702.hpp"
-#include "ihs_x_type.hpp"
#include <exception>
@@ -41,10 +40,10 @@ enum
,precision_changed = 0x0002
,implausible_input = 0x0004
,inconsistent_input = 0x0008
- ,product_rule_violated = 0x0010
- ,adjustable_event_forbidden_at_issue = 0x0020
- ,guideline_negative = 0x0040
- ,misstatement_of_age_or_gender = 0x0080
+ ,adjustable_event_forbidden_at_issue = 0x0010
+ ,guideline_negative = 0x0020
+ ,misstatement_of_age_or_gender = 0x0040
+ ,runtime_error = 0x0080
};
//============================================================================
@@ -116,11 +115,6 @@ void Server7702::Process()
Output.Status |= inconsistent_input;
warning() << Output.ContractNumber << " error: " << e.what() <<
LMI_FLUSH;
}
- catch(x_product_rule_violated const& e)
- {
- Output.Status |= product_rule_violated;
- warning() << Output.ContractNumber << " error: " << e.what() <<
LMI_FLUSH;
- }
catch(server7702_adjustable_event_forbidden_at_issue const& e)
{
Output.Status |= adjustable_event_forbidden_at_issue;
@@ -141,6 +135,11 @@ void Server7702::Process()
Output.Status |= implausible_input; // TODO ?? can we be more specific?
warning() << Output.ContractNumber << " error: " << e.what() <<
LMI_FLUSH;
}
+ catch(std::runtime_error const& e)
+ {
+ Output.Status |= runtime_error;
+ warning() << Output.ContractNumber << " error: " << e.what() <<
LMI_FLUSH;
+ }
// Unknown error
catch(std::exception const& e)
diff --git a/ihs_x_type.hpp b/ihs_x_type.hpp
deleted file mode 100644
index c109757..0000000
--- a/ihs_x_type.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// GPT server exception type.
-//
-// Copyright (C) 1998, 2001, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Gregory W. Chicares.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-//
-// https://savannah.nongnu.org/projects/lmi
-// email: <gchicares@sbcglobal.net>
-// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
-
-#ifndef ihs_x_type_hpp
-#define ihs_x_type_hpp
-
-#include "config.hpp"
-
-#include <stdexcept>
-#include <string>
-
-class x_product_rule_violated
- :public std::runtime_error
-{
- public:
- x_product_rule_violated(std::string const& what_arg)
- :std::runtime_error("Product rule violated: " + what_arg)
- {}
-};
-
-#endif // ihs_x_type_hpp
- [lmi-commits] [lmi] valyuta/004 updated (7192b10 -> cf62b44), Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 3c157f7 03/17: Report a range error when a range error is caught [336], Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 2504286 04/17: Resolve some marked defects [333], Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 eeacb20 07/17: Prepare to move a block of code, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 f16fd3a 02/17: Expunge an unwanted exception class,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/004 5ceb54d 01/17: Move an enum, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 5ac107f 09/17: Refactor, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 c9b4787 13/17: Make two member functions almost identical, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 cf62b44 17/17: Record timings, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 9d9c2b7 06/17: Assert "length" is same in two classes, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 67f1c54 08/17: Move a block of code as just announced, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 80a18db 14/17: Make two member functions identical, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 89ea7c8 15/17: Change a member's datatype, Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 c6f6f55 16/17: Expunge a duplicative member function [325], Greg Chicares, 2020/12/24
- [lmi-commits] [lmi] valyuta/004 17275df 05/17: Resolve some more marked defects [326], Greg Chicares, 2020/12/24