Hold translated exception in local string while matching

This commit is contained in:
Phil Nash 2017-08-17 19:19:17 +01:00
parent ee75b324e7
commit 0545de0a31

View File

@ -16,7 +16,8 @@ namespace Catch {
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers // There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
// the Equals matcher (so the header does not mention matchers) // the Equals matcher (so the header does not mention matchers)
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString ); std::string exceptionMessage = Catch::translateActiveException();
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
handler.handle( expr ); handler.handle( expr );
} }