rippled
Loading...
Searching...
No Matches
libxrpl/basics/contract.cpp
1#include <xrpl/basics/Log.h>
2#include <xrpl/basics/contract.h>
3#include <xrpl/beast/utility/instrumentation.h>
4
5#include <cstdlib>
6#include <iostream>
7#include <string>
8
9namespace ripple {
10
11void
12LogThrow(std::string const& title)
13{
14 JLOG(debugLog().warn()) << title;
15}
16
17[[noreturn]] void
18LogicError(std::string const& s) noexcept
19{
20 // LCOV_EXCL_START
21 JLOG(debugLog().fatal()) << s;
22 std::cerr << "Logic error: " << s << std::endl;
23 // Use a non-standard contract naming here (without namespace) because
24 // it's the only location where various unrelated execution paths may
25 // register an error; this is also why the "message" parameter is passed
26 // here.
27 // For the above reasons, we want this contract to stand out.
28 UNREACHABLE("LogicError", {{"message", s}});
29 std::abort();
30 // LCOV_EXCL_STOP
31}
32
33} // namespace ripple
T abort(T... args)
T endl(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
beast::Journal debugLog()
Returns a debug journal.
Definition Log.cpp:457
void LogThrow(std::string const &title)
Generates and logs a call stack.
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.