Generic hardware access library
|
00001 #include "ExceptionTester.hh" 00002 00003 string HAL::ExceptionTester::getDescription() const { 00004 stringstream text; 00005 text << "Tests the Exception mechanism in the HAL\n" 00006 << "The HAL::IllegalOperationException is used for this\n" 00007 << ends; 00008 return text.str(); 00009 } 00010 00011 bool HAL::ExceptionTester::execute() { 00012 bool result = false; 00013 try { 00014 throw ( HAL::IllegalOperationException( "this is the exception message", 00015 __FILE__, __LINE__, 00016 __FUNCTION__ ) ); 00017 } catch (HAL::HardwareAccessException& e ) { 00018 cout << e.what() << endl; 00019 cout << "name : " << e.name() << endl; 00020 cout << "message : " << e.message() << endl; 00021 cout << "module : " << e.module() << endl; 00022 cout << "function : " << e.function() << endl; 00023 cout << "line : " << e.line() << endl; 00024 result = true; 00025 } 00026 // all ok if arrived here 00027 return result; 00028 }