Improve exception handling:

* Self-document the code by renaming Throw to Rethrow.
* Write a message to the debug log when we throw or
  rethrow an exception.
This commit is contained in:
Nik Bougalis
2016-05-18 13:00:11 -07:00
parent a039e7593a
commit 97c89168f7
10 changed files with 47 additions and 26 deletions

View File

@@ -19,6 +19,7 @@
#include <BeastConfig.h>
#include <ripple/basics/contract.h>
#include <ripple/basics/Log.h>
#include <cstdlib>
#include <exception>
#include <iostream>
@@ -39,10 +40,17 @@ accessViolation() noexcept
} // detail
void
LogThrow (std::string const& title)
{
JLOG(debugLog()) << title;
}
[[noreturn]]
void
LogicError (std::string const& s) noexcept
{
JLOG(debugLog()) << s;
std::cerr << "Logic error: " << s << std::endl;
detail::accessViolation();
}