MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / HandleSehExceptionsInMethodIfSupported

Function HandleSehExceptionsInMethodIfSupported

tests/gtest/gtest-all.cc:3908–3929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3906// wrapper function for handling SEH exceptions.)
3907template <class T, typename Result>
3908Result HandleSehExceptionsInMethodIfSupported(
3909 T* object, Result (T::*method)(), const char* location) {
3910#if GTEST_HAS_SEH
3911 __try {
3912 return (object->*method)();
3913 } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
3914 GetExceptionCode())) {
3915 // We create the exception message on the heap because VC++ prohibits
3916 // creation of objects with destructors on stack in functions using __try
3917 // (see error C2712).
3918 std::string* exception_message = FormatSehExceptionMessage(
3919 GetExceptionCode(), location);
3920 internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
3921 *exception_message);
3922 delete exception_message;
3923 return static_cast<Result>(0);
3924 }
3925#else
3926 (void)location;
3927 return (object->*method)();
3928#endif // GTEST_HAS_SEH
3929}
3930
3931// Runs the given method and catches and reports C++ and/or SEH-style
3932// exceptions, if they are supported; returns the 0-value for type

Callers 1

Calls 2

Tested by

no test coverage detected