List:MySQL++« Previous MessageNext Message »
From:Charles @ GB Date:March 2 2005 8:32pm
Subject:C++ isapi try catch
View as plain text  
I'm wondering if using C++ try...catch blocks in ISAPI works the same way as
in console apps?


I'm asking because I have made an ISAPI filter using them and when a crash
happens, the filter gets reloaded and the catch doesn' get executed,
where-as in my console app, everything works great. (i've also replaced cerr
<<  with a logging function, still the same result)

Code as follows:

try{
con.connect("authorizer", "db_writer_hostname", "db_writer_username",
"db_writer_password_BAAAAAD");
}
 catch (BadQuery& er) {
    // handle any connection or query errors that may come up
    #ifdef USE_STANDARD_EXCEPTION
    cerr << "Error: " << er.what() << " " << con.errnum() <<
endl;
    #else
    cerr << "Error: " << er.error << " " << con.errnum() <<
endl;
    #endif
    return -1;
   }
   catch (BadConversion& er) {
    #ifdef USE_STANDARD_EXCEPTION
    cerr << "Error: " << er.what() << "\"." << endl
    << "retrieved data size: " << er.retrieved
    << " actual data size: " << er.actual_size << endl;
    #else
    cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
    << er.type_name << "\"." << endl;
    #endif
    return -1;
   }
   #ifdef USE_STANDARD_EXCEPTION
   catch (exception& er) {
    cerr << "Error: " << er.what() << endl;
    return -1;
   }
   #endif


Thread
C++ isapi try catchCharles @ GB2 Mar
Re: C++ isapi try catchWarren Young3 Mar