Exceptions generate less mysterious error messages in a few places

This commit is contained in:
Ray Speth 2012-03-05 20:46:46 +00:00
parent 000117cad3
commit 2fa2d98171
3 changed files with 14 additions and 11 deletions

View file

@ -178,8 +178,9 @@ void ct2ctml(const char* file, const int debug)
writelog("cannot open ct2ctml.log for reading.\n");
}
}
} catch (...) {
writelog("ct2ctml: caught something \n");
} catch (std::exception& err) {
writelog("ct2ctml: Exception while trying to parse ct2ctml.log:\n");
writelog(err.what());
}
if (ierr != 0) {
string msg = cmd;
@ -245,8 +246,9 @@ void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string file, const int
if (ext != ".xml" && ext != ".ctml") {
try {
ctml::ct2ctml(inname.c_str(), debug);
} catch (...) {
writelog("get_CTML_Tree: caught something \n");
} catch (std::exception& err) {
writelog("get_CTML_Tree: caught an exception:\n");
writelog(err.what());
}
string ffull = inname.substr(0,idot) + ".xml";
ff = "./" + getBaseName(ffull) + ".xml";

View file

@ -302,12 +302,13 @@ bool CKReader::read(const std::string& inputFile, const std::string& thermoDatab
}
}
catch (CK_Exception e) {
catch (CK_Exception& e) {
log << e.errorMessage() << endl;
//Cantera::setError("CKReader::read",e.errorMessage());
return false;
} catch (...) {
log << "an exception was raised in CKReader.";
} catch (std::exception& e) {
log << "an exception was raised in CKReader:\n";
log << e.what() << std::endl;
return false;
}

View file

@ -211,8 +211,8 @@ void ReactorNet::eval(doublereal t, doublereal* y,
start += m_size[n];
pstart += m_nparams[n];
}
} catch (...) {
showErrors();
} catch (CanteraError& err) {
std::cerr << err.what() << std::endl;
error("Terminating execution.");
}
}
@ -247,8 +247,8 @@ void ReactorNet::evalJacobian(doublereal t, doublereal* y,
}
y[n] = ysave;
}
} catch (...) {
showErrors();
} catch (CanteraError& err) {
std::cerr << err.what() << std::endl;
error("Terminating execution.");
}
}