Visual BasicOn Error goto Erh1
Visual Basicexit subErh1: call setLog(err.msg);
try{.........какой то код.........}catch(...){setLog([color=red][b]????????[/b][/color]);}
class BaseException{public: virtual char* getMessage() {return (char*)"Unknown Error.\n";} std::ostream& printErr(std::ostream &os=std::cerr) {return os<<getMessage();}}; class Exception1:public BaseException{public: virtual char* getMessage() {return (char*)"Wrong Size.\n";}}; class Exception2:public BaseException{public: virtual char* getMessage() {return (char*)"Can't alocate memory.\n";}};
try{//кодif(error) throw Exception2();//код}catch(BaseException& ex){ex.printErr();}
#include <stdexcept>using namespace std;...try{...throw runtime_error("any error");...}catch(runtime_error& x){setLog(x.what());}
try { /*some code*/ }catch (std::exception const &e){ std::cerr << "error: " << e.what () << "\n";}
if (bad) throw std::runtime_error ("bad thing happened!");
if (bad){ errLog << "bad thing happened!\n"; return 1;}