about summary refs log tree commit diff
path: root/absl/base/internal/exception_safety_testing.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/base/internal/exception_safety_testing.cc')
-rw-r--r--absl/base/internal/exception_safety_testing.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/absl/base/internal/exception_safety_testing.cc b/absl/base/internal/exception_safety_testing.cc
index ab8d6c9fb4d0..821438ecc28c 100644
--- a/absl/base/internal/exception_safety_testing.cc
+++ b/absl/base/internal/exception_safety_testing.cc
@@ -23,8 +23,11 @@ namespace exceptions_internal {
 
 int countdown = -1;
 
-void MaybeThrow(absl::string_view msg) {
-  if (countdown-- == 0) throw TestException(msg);
+void MaybeThrow(absl::string_view msg, bool throw_bad_alloc) {
+  if (countdown-- == 0) {
+    if (throw_bad_alloc) throw TestBadAllocException(msg);
+    throw TestException(msg);
+  }
 }
 
 testing::AssertionResult FailureMessage(const TestException& e,