1 #ifndef CARMA_UTIL_EXCEPTION_UTILS_H
2 #define CARMA_UTIL_EXCEPTION_UTILS_H
7 #include <log4cpp/Priority.hh>
8 #include <log4cpp/Category.hh>
17 ::std::string getStringForCaught( );
20 void logCaught( log4cpp::Category & logger,
21 log4cpp::Priority::PriorityLevel priority );
22 void logCaught( log4cpp::Category & logger,
23 log4cpp::Priority::PriorityLevel priority,
24 const ::std::string & preface );
26 void logCaught( log4cpp::Priority::PriorityLevel priority );
27 void logCaught( log4cpp::Priority::PriorityLevel priority,
28 const ::std::string & preface );
30 void logCaughtAsError( log4cpp::Category & logger );
31 void logCaughtAsError( log4cpp::Category & logger,
32 const ::std::string & preface );
34 void logCaughtAsError( );
35 void logCaughtAsError( const ::std::string & preface );
37 void traceCaught(
int traceLevel );
40 void rethrowCaughtAsUser( );
42 void logCaughtAndRethrowAsUser( log4cpp::Category & logger,
43 log4cpp::Priority::PriorityLevel priority );
44 void logCaughtAndRethrowAsUser( log4cpp::Category & logger,
45 log4cpp::Priority::PriorityLevel priority,
46 const ::std::string & preface );
47 void logCaughtAndRethrowAsUser( log4cpp::Category & logger,
48 log4cpp::Priority::PriorityLevel priority,
49 const char * preface );
51 void logCaughtAndRethrowAsUser( log4cpp::Priority::PriorityLevel priority );
52 void logCaughtAndRethrowAsUser( log4cpp::Priority::PriorityLevel priority,
53 const ::std::string & preface );
54 void logCaughtAndRethrowAsUser( log4cpp::Priority::PriorityLevel priority,
55 const char * preface );
57 void logCaughtAsErrorAndRethrowAsUser( log4cpp::Category & logger );
58 void logCaughtAsErrorAndRethrowAsUser( log4cpp::Category & logger,
59 const ::std::string & preface );
60 void logCaughtAsErrorAndRethrowAsUser( log4cpp::Category & logger,
61 const char * preface );
63 void logCaughtAsErrorAndRethrowAsUser( );
64 void logCaughtAsErrorAndRethrowAsUser( const ::std::string & preface );
65 void logCaughtAsErrorAndRethrowAsUser(
const char * preface );
67 void traceCaughtAndRethrowAsUser(
int traceLevel );
70 void terminateHandler( );
72 void unexpectedHandler( );
75 bool caughtBacktraceCaptured( );
78 ::std::string getCaughtBacktraceAsString( );
80 ::std::string getCaughtBacktraceAsString( const ::std::string & linePrefix,
81 const ::std::string & lineSuffix );
83 ::std::string getCaughtBacktraceAsString(
const char * linePrefix,
84 const char * lineSuffix );
87 void logCaughtBacktraceAsError( log4cpp::Category & logger );
89 void logCaughtBacktraceAsError( log4cpp::Category & logger,
90 const ::std::string & linePrefix );
92 void logCaughtBacktraceAsError( log4cpp::Category & logger,
93 const char * linePrefix );
95 void logCaughtBacktraceAsErrorIfPossible( );
97 void logCaughtBacktraceAsErrorIfPossible( const ::std::string & linePrefix );
99 void logCaughtBacktraceAsErrorIfPossible(
const char * linePrefix );
106 logAndRethrowCaughtExceptionAsUserException(
107 log4cpp::Category & logger,
108 const log4cpp::Priority::PriorityLevel priority )
110 logCaughtAndRethrowAsUser( logger, priority );
115 logAndRethrowCaughtExceptionAsUserException(
116 const log4cpp::Priority::PriorityLevel priority )
118 logCaughtAndRethrowAsUser( priority );