First cut of custom exception support

This commit is contained in:
Phil Nash committed 2011-04-20 15:40:40 +01:00
1 parent d4117b9208
commit 9430a2c4c8
8 files changed
+192 -2

No files matched your search

+33
View File
@@ -62,3 +62,36 @@ TEST_CASE( "./succeeding/exceptions/implicit", "When unchecked exceptions are th
{
}
}
class CustomException
{
public:
CustomException( const std::string& msg )
: m_msg( msg )
{}
std::string getMessage() const
{
return m_msg;
}
private:
std::string m_msg;
};
namespace Catch
{
ExceptionTranslator<CustomException> translator;
template<>
std::string ExceptionTranslator<CustomException>::translate( CustomException& ex ) const
{
return ex.getMessage();
}
}
TEST_CASE_NORETURN( "./succeeding/exceptions/custom", "" )
{
throw CustomException( "custom exception" );
}