20#include "CLHEP/Exceptions/defs.h"
21#include "CLHEP/Cast/itos.h"
22#include "CLHEP/Exceptions/ZMthrow.h"
23#include "CLHEP/Exceptions/ZMexAction.h"
24#include "CLHEP/Exceptions/ZMexClassInfo.h"
25#include "CLHEP/Exceptions/ZMexSeverity.h"
26#include "CLHEP/Exceptions/ZMerrno.h"
27#include "CLHEP/Exceptions/ZMexception.h"
44#ifdef DEFECT_NO_EXCEPTIONS
47 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
50 ZMlogger().emit( "Note: exception would have been correctly thrown here\n" );
92 +
" " + (ex->
wasThrown() ?
"thrown" :
"ignored")
106 ZMlogger().
emit(
"---------- Begin testing: ----------\n" );
108 ZMlogger().
emit(
"This message checks out basic logger behavior\n" );
116 "---------- Testing default informational behavior: ----------\n" );
118 ZMthrow( ZMxInfo(
"Testing default informational exception behavior" ) );
126 "---------- Testing default ostringstream behavior 3 times: ----------\n" );
127 std::ostringstream oss;
128 oss <<
"Accumulated numbers are ";
129 for ( k = 0; k < 3; ++k ) {
142 "---------- Testing default ignoring behavior 3 times: ----------\n" );
143 for ( k = 0; k < 3; ++k ) {
145 string testMesg =
"Testing default exception ignoring behavior #";
155 "---------- Testing defined ignoring behavior 3 times: ----------\n" );
156 for ( k = 0; k < 3; ++k ) {
158 string testMesg =
"Testing defined exception ignoring behavior #";
167 "---------- Testing default throwing behavior 3 times: ----------\n" );
168 for ( k = 0; k < 3; ++k ) {
170 string testMesg =
"Testing default exception throwing behavior #";
171#ifndef DEFECT_NO_EXCEPTIONS
175#ifndef DEFECT_NO_EXCEPTIONS
178 std::cerr <<
"Caught: " << e.
name() <<
"\n";
189 "---------- Testing forced throwing behavior 3 times: ----------\n" );
191 for ( k = 0; k < 3; ++k ) {
193 string testMesg =
"Testing forced exception throwing behavior #";
194#ifndef DEFECT_NO_EXCEPTIONS
198#ifndef DEFECT_NO_EXCEPTIONS
201 std::cerr <<
"Caught: " << e.
name() <<
"\n";
211 "---------- Testing scheduled throwing behavior 3 times: ----------\n" );
213 for ( k = 0; k < 3; ++k ) {
215 string testMesg =
"Testing scheduled exception throwing behavior #";
216#ifndef DEFECT_NO_EXCEPTIONS
220#ifndef DEFECT_NO_EXCEPTIONS
223 std::cerr <<
"Caught: " << e.
name() <<
"\n";
236 ZMlogger().
emit(
"---------- Test exception history: ----------\n" );
241 +
" exceptions were recorded (most recent first):\n"
246 const int NEWMAX = 4;
254 ZMlogger().
emit(
string(
" we now have record of these " )
#define ZMexStandardDefinition(Parent, Class)
#define ZMthrow(userExcept)
unsigned int setMax(unsigned int limit)
unsigned int size() const
const ZMexception * get(unsigned int k=0) const
ZMexLogResult emit(const ZMexception &exc)
std::string handlerUsed() const
std::string message() const
virtual std::string name() const
void display(const ZMexception *ex)