Browse Source

[master] Merged trac4307 (uncaught exception in d2 server main())

Francis Dupont 9 years ago
parent
commit
a24d3e9337
3 changed files with 12 additions and 8 deletions
  1. 4 4
      src/bin/d2/main.cc
  2. 2 2
      src/bin/perfdhcp/main.cc
  3. 6 2
      src/lib/log/compiler/message.cc

+ 4 - 4
src/bin/d2/main.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -24,12 +24,12 @@ using namespace std;
 int main(int argc, char* argv[]) {
     int ret = EXIT_SUCCESS;
 
-    // Instantiate/fetch the DHCP-DDNS application controller singleton.
-    DControllerBasePtr& controller = D2Controller::instance();
-
     // Launch the controller passing in command line arguments.
     // Exit program with the controller's return code.
     try  {
+        // Instantiate/fetch the DHCP-DDNS application controller singleton.
+        DControllerBasePtr& controller = D2Controller::instance();
+
         // 'false' value disables test mode.
         controller->launch(argc, argv, false);
     } catch (const VersionMessage& ex) {

+ 2 - 2
src/bin/perfdhcp/main.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -44,7 +44,7 @@ main(int argc, char* argv[]) {
     try{
         TestControl& test_control = TestControl::instance();
         ret_code =  test_control.run();
-    } catch (isc::Exception& e) {
+    } catch (std::exception& e) {
         ret_code = 1;
         std::cerr << "Error running perfdhcp: " << e.what() << std::endl;
         if (diags.find('e') != std::string::npos) {

+ 6 - 2
src/lib/log/compiler/message.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -559,7 +559,11 @@ main(int argc, char* argv[]) {
         // Format with arguments
         vector<string> args(e.arguments());
         for (size_t i(0); i < args.size(); ++ i) {
-            replacePlaceholder(&text, args[i], i + 1);
+            try {
+                replacePlaceholder(&text, args[i], i + 1);
+            } catch (...) {
+                // Error in error handling: nothing right to do...
+            }
         }
 
         cerr << text << "\n";