~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/src/cppunit/DefaultProtector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <cppunit/Exception.h>
 
2
#include <cppunit/extensions/TypeInfoHelper.h>
 
3
#include "DefaultProtector.h"
 
4
 
 
5
 
 
6
CPPUNIT_NS_BEGIN
 
7
 
 
8
 
 
9
bool 
 
10
DefaultProtector::protect( const Functor &functor,
 
11
                           const ProtectorContext &context )
 
12
{
 
13
  try
 
14
  {
 
15
    return functor();
 
16
  }
 
17
  catch ( Exception &failure )
 
18
  {
 
19
    reportFailure( context, failure );
 
20
  }
 
21
  catch ( std::exception &e )
 
22
  {
 
23
    std::string shortDescription( "uncaught exception of type " );
 
24
#if CPPUNIT_USE_TYPEINFO_NAME
 
25
    shortDescription += TypeInfoHelper::getClassName( typeid(e) );
 
26
#else
 
27
    shortDescription += "std::exception (or derived).";
 
28
#endif
 
29
    Message message( shortDescription, e.what() );
 
30
    reportError( context, message );
 
31
  }
 
32
  catch ( ... )
 
33
  {
 
34
    reportError( context,
 
35
                 Message( "uncaught exception of unknown type") );
 
36
  }
 
37
  
 
38
  return false;
 
39
}
 
40
 
 
41
 
 
42
CPPUNIT_NS_END