Skip to content
Bitcoin Roots

v29.4-roots.1 · Commit 2: [PATCH 02/13] runtime: preserve shared operator controls

src/util/check.cpp

Before: src/util/check.cpp · After: src/util/check.cpp

File metadata
index 1430c0e8e2983c1ce76499b4f83778e9fca9a579..81d0b78322af212ae50857514c61a6840c64efa5 100644

Download original patch · Release notes

Diff rows 1–13 of 13. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/util/check.cpp CHANGED
@@ -27,8 +27,13 @@ NonFatalCheckError::NonFatalCheckError(std::string_view msg, std::string_view fi
27
  {
28
  }
29
 
 
 
30
  void assertion_fail(std::string_view file, int line, std::string_view func, std::string_view assertion)
31
  {
 
 
 
32
  auto str = strprintf("%s:%s %s: Assertion `%s' failed.\n", file, line, func, assertion);
33
  fwrite(str.data(), 1, str.size(), stderr);
34
  std::abort();
 
27
  {
28
  }
29
 
30
+ bool g_detail_test_only_CheckFailuresAreExceptionsNotAborts{false};
31
+
32
  void assertion_fail(std::string_view file, int line, std::string_view func, std::string_view assertion)
33
  {
34
+ if (g_detail_test_only_CheckFailuresAreExceptionsNotAborts) {
35
+ throw NonFatalCheckError{assertion, file, line, func};
36
+ }
37
  auto str = strprintf("%s:%s %s: Assertion `%s' failed.\n", file, line, func, assertion);
38
  fwrite(str.data(), 1, str.size(), stderr);
39
  std::abort();