diff options
Diffstat (limited to 'configd')
-rw-r--r-- | configd/src/apps/sentinel/config-handler.cpp | 6 | ||||
-rw-r--r-- | configd/src/apps/sentinel/sentinel.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/configd/src/apps/sentinel/config-handler.cpp b/configd/src/apps/sentinel/config-handler.cpp index a73a5f01f33..7b68e6c8150 100644 --- a/configd/src/apps/sentinel/config-handler.cpp +++ b/configd/src/apps/sentinel/config-handler.cpp @@ -5,6 +5,8 @@ #include <vespa/vespalib/net/simple_metric_snapshot.h> #include <vespa/vespalib/net/socket_address.h> +#include <vespa/vespalib/util/exceptions.h> +#include <string> #include <fcntl.h> #include <sys/wait.h> @@ -24,9 +26,7 @@ ConfigHandler::configure_port(int port) } } if (port <= 0 || port > 65535) { - LOG(error, "Fatal: bad port %d, expected range [1,65535]", port); - EV_STOPPING("config-sentinel", "bad port"); - exit(EXIT_FAILURE); + throw vespalib::FatalException("Bad port " + std::to_string(port) + ", expected range [1, 65535]", VESPA_STRLOC); } if (port != _boundPort) { LOG(debug, "Config-sentinel accepts connections on port %d", port); diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp index 741eb5514bb..126c59d42f3 100644 --- a/configd/src/apps/sentinel/sentinel.cpp +++ b/configd/src/apps/sentinel/sentinel.cpp @@ -91,6 +91,10 @@ main(int argc, char **argv) LOG(error, "Fatal: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); exit(EXIT_FAILURE); + } catch (vespalib::FatalException& ex) { + LOG(error, "Fatal: %s", ex.getMessage().c_str()); + EV_STOPPING("config-sentinel", ex.what()); + exit(EXIT_FAILURE); } if (vespalib::SignalHandler::CHLD.check()) { continue; |