From d683b47dee55461077b25c2237d9b586bbe350bc Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 26 Sep 2013 15:11:23 -0700 Subject: [PATCH] Call std::exit for unhandled exceptions --- src/BeastConfig.h | 4 ++-- src/ripple_app/main/RippleMain.cpp | 16 ++++++++++++++++ src/ripple_app/main/RippleMain.h | 6 +++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/BeastConfig.h b/src/BeastConfig.h index 6b960f2f7..05dc73cdc 100644 --- a/src/BeastConfig.h +++ b/src/BeastConfig.h @@ -81,8 +81,8 @@ are thrown. @see ProtectedCall */ -#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS -//#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1 +#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS +#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1 #endif //------------------------------------------------------------------------------ diff --git a/src/ripple_app/main/RippleMain.cpp b/src/ripple_app/main/RippleMain.cpp index 51bdb7c03..4ded9a23b 100644 --- a/src/ripple_app/main/RippleMain.cpp +++ b/src/ripple_app/main/RippleMain.cpp @@ -17,6 +17,22 @@ */ //============================================================================== +RippleMain::RippleMain() +{ + ProtectedCall::setHandler (*this); +} + +RippleMain::~RippleMain() +{ + +} + +void RippleMain::onException (ProtectedCall::Exception const& e) const +{ + std::_Exit(EXIT_FAILURE); +} + +//------------------------------------------------------------------------------ namespace po = boost::program_options; diff --git a/src/ripple_app/main/RippleMain.h b/src/ripple_app/main/RippleMain.h index 428ae1439..b77b04830 100644 --- a/src/ripple_app/main/RippleMain.h +++ b/src/ripple_app/main/RippleMain.h @@ -21,9 +21,13 @@ #ifndef RIPPLE_RIPPLEMAIN_H_INCLUDED #define RIPPLE_RIPPLEMAIN_H_INCLUDED -class RippleMain : public Main +class RippleMain : public Main, public ProtectedCall::Handler { public: + RippleMain (); + ~RippleMain (); + + void onException (ProtectedCall::Exception const& e) const; int run (int argc, char const* const* argv); };