Changeset 12078
- Timestamp:
- 04/20/12 13:46:58 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/include/macros.h
r12022 r12078 57 57 _printf_(true,"Standard exception: %s\n",e.what());\ 58 58 return 1;\ 59 }\ 60 catch(...){\ 61 _printf_(true,"An unexpected error occurred");\ 59 62 } 60 63 /*}}}*/ -
issm/trunk-jpl/src/c/matlab/include/matlab_macros.h
r12031 r12078 20 20 * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions 21 21 * will be trapped. Really nifty!*/ 22 //exception.Report(); 22 23 23 24 #define MODULEBOOT(); ModuleBoot(); \ … … 26 27 #define MODULEEND(); ModuleEnd(); }\ 27 28 catch(ErrorException &exception){\ 28 exception.Report(); \ 29 mexErrMsgTxt(""); \ 29 mexErrMsgTxt("ISSM Error"); \ 30 30 }\ 31 catch (exception& e) {\ 32 _printf_(true,"Standard exception: %s\n",e.what());\ 33 mexErrMsgTxt(" ");\ 31 catch (exception &e){\ 32 mexErrMsgTxt(exprintf("Standard exception: %s\n",e.what()));\ 33 }\ 34 catch(...){\ 35 mexErrMsgTxt("An unexpected error occurred");\ 34 36 } 35 37 //}}} -
issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
r12018 r12078 29 29 30 30 ErrorException::~ErrorException() throw(){ 31 extern int num_procs; 32 /*We want the report only for matlab modules, otherwise we get twice the report 33 * We assume that if num_procs==1, it is a module (FIXME)*/ 34 if(num_procs==1) this->Report(); 31 35 } 32 36 … … 37 41 void ErrorException::Report(){ 38 42 extern int my_rank; 43 extern int num_procs; 39 44 40 45 if (function_name=="" || file_line==0){ //WINDOWS … … 42 47 } 43 48 else{ 44 printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line); 45 printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what()); 49 if(num_procs==1){ 50 printf("\n??? Error using ==> %s:%i\n",file_name.c_str(),file_line); 51 printf("%s error message: %s\n\n",function_name.c_str(),what()); 52 } 53 else{ 54 printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line); 55 printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what()); 56 } 46 57 } 47 58 return; -
issm/trunk-jpl/src/c/shared/Exceptions/exceptions.h
r11199 r12078 17 17 class ErrorException: public exception { 18 18 19 public: 20 19 21 string what_str; 20 22 string function_name; … … 22 24 int file_line; 23 25 24 public:25 26 26 27 ErrorException(const string &what_arg); //for windows 27 28 ErrorException(string what_file,string what_function,int what_line,string what_arg);//UNIX 28 29 ~ErrorException() throw(); 29 30 30 virtual const char *what() const throw(); 31 32 31 void Report(); 33 32
Note:
See TracChangeset
for help on using the changeset viewer.