Go to the documentation of this file.
21 #include "CLHEP/Cast/itos.h"
39 #ifdef DEFECT_NO_EXCEPTIONS
42 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
45 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
47 #endif // DEFECT_NO_EXCEPTIONS
87 +
" " + (ex->
wasThrown() ?
"thrown" :
"ignored")
101 ZMlogger().
emit(
"---------- Begin testing: ----------\n" );
103 ZMlogger().
emit(
"This message checks out basic logger behavior\n" );
111 "---------- Testing default informational behavior: ----------\n" );
113 ZMthrow( ZMxInfo(
"Testing default informational exception behavior" ) );
121 "---------- Testing default ostringstream behavior 3 times: ----------\n" );
122 std::ostringstream oss;
123 oss <<
"Accumulated numbers are ";
124 for (
k = 0;
k < 3; ++
k ) {
137 "---------- Testing default ignoring behavior 3 times: ----------\n" );
138 for (
k = 0;
k < 3; ++
k ) {
140 string testMesg =
"Testing default exception ignoring behavior #";
150 "---------- Testing defined ignoring behavior 3 times: ----------\n" );
151 for (
k = 0;
k < 3; ++
k ) {
153 string testMesg =
"Testing defined exception ignoring behavior #";
162 "---------- Testing default throwing behavior 3 times: ----------\n" );
163 for (
k = 0;
k < 3; ++
k ) {
165 string testMesg =
"Testing default exception throwing behavior #";
166 #ifndef DEFECT_NO_EXCEPTIONS
170 #ifndef DEFECT_NO_EXCEPTIONS
173 std::cerr <<
"Caught: " << e.
name() <<
"\n";
184 "---------- Testing forced throwing behavior 3 times: ----------\n" );
186 for (
k = 0;
k < 3; ++
k ) {
188 string testMesg =
"Testing forced exception throwing behavior #";
189 #ifndef DEFECT_NO_EXCEPTIONS
193 #ifndef DEFECT_NO_EXCEPTIONS
196 std::cerr <<
"Caught: " << e.
name() <<
"\n";
206 "---------- Testing scheduled throwing behavior 3 times: ----------\n" );
208 for (
k = 0;
k < 3; ++
k ) {
210 string testMesg =
"Testing scheduled exception throwing behavior #";
211 #ifndef DEFECT_NO_EXCEPTIONS
215 #ifndef DEFECT_NO_EXCEPTIONS
218 std::cerr <<
"Caught: " << e.
name() <<
"\n";
231 ZMlogger().
emit(
"---------- Test exception history: ----------\n" );
236 +
" exceptions were recorded (most recent first):\n"
241 const int NEWMAX = 4;
249 ZMlogger().
emit(
string(
" we now have record of these " )
#define ZMthrow(userExcept)
std::string handlerUsed() const
virtual std::string name() const
const ZMexception * get(unsigned int k=0) const
void display(const ZMexception *ex)
unsigned int setMax(unsigned int limit)
The given behavior will apply to any exceptions ZMthrow n after the handler has been established Available handlers Here is a list of the five standard handlers that are defined via the Exceptions package Each is accompanied by a brief description of its after become the object of a C throw ZMexIgnoreAlways() the ZMthrow 'n exception instance will be handled
ZMexStandardDefinition(ZMexception, ZMxTest)
std::string message() const
unsigned int size() const
ZMexLogResult emit(const ZMexception &exc)
it is important to be consistent ZMexception is the name of the parent exception class of ZMxOops