Summary:
When terminating because we were told to rethrow a nonexistent exception, we
now print that to `std::cerr` for the benefit of users on platforms which do not dump a stack trace on
`std::terminate`
Reviewed By: yfeldblum
Differential Revision:
D4001087
fbshipit-source-id:
5b834cfc75bf42bec06a49ac9db55789a83df180
#include <cassert>
#include <exception>
+#include <iostream>
#include <memory>
#include <folly/ExceptionString.h>
#include <folly/detail/ExceptionWrapper.h>
} else if (eptr_) {
std::rethrow_exception(eptr_);
}
+ std::cerr
+ << "Cannot use `throwException` with an empty folly::exception_wrapper"
+ << std::endl;
std::terminate();
}
TEST(ExceptionWrapper, throwException_noException) {
exception_wrapper ew;
- ASSERT_DEATH(ew.throwException(), "exception");
+ ASSERT_DEATH(ew.throwException(), "empty folly::exception_wrapper");
}
namespace {