Replace most naked throws with macros from catch_enforce.h

This is a first step towards support a no-exceptions mode
This commit is contained in:
Martin Hořeňovský
2018-09-03 10:03:47 +02:00
parent ef9150fe6f
commit 86da2846af
7 changed files with 28 additions and 34 deletions

View File

@@ -8,6 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
#include "../internal/catch_enforce.h"
#include "../internal/catch_interfaces_reporter.h"
#include <algorithm>
@@ -33,7 +34,7 @@ namespace Catch {
{
m_reporterPrefs.shouldRedirectStdOut = false;
if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
throw std::domain_error( "Verbosity level not supported by this reporter" );
CATCH_ERROR( "Verbosity level not supported by this reporter" );
}
ReporterPreferences getPreferences() const override {
@@ -148,7 +149,7 @@ namespace Catch {
{
m_reporterPrefs.shouldRedirectStdOut = false;
if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
throw std::domain_error( "Verbosity level not supported by this reporter" );
CATCH_ERROR( "Verbosity level not supported by this reporter" );
}
~CumulativeReporterBase() override = default;

View File

@@ -97,12 +97,12 @@ namespace Catch {
case ResultWas::Ok:
case ResultWas::Info:
case ResultWas::Warning:
throw std::domain_error( "Internal error in TeamCity reporter" );
CATCH_ERROR( "Internal error in TeamCity reporter" );
// These cases are here to prevent compiler warnings
case ResultWas::Unknown:
case ResultWas::FailureBit:
case ResultWas::Exception:
throw std::domain_error( "Not implemented" );
CATCH_ERROR( "Not implemented" );
}
if( assertionStats.infoMessages.size() == 1 )
msg << " with message:";