~ubuntu-branches/ubuntu/utopic/psi/utopic

« back to all changes in this revision

Viewing changes to third-party/cppunit/cppunit/src/cppunit/DefaultProtector.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

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