Fix calls to CanteraError with blank or incorrect first argument
The first argument should be the function name from which the exception was thrown. Leaving this blank makes it difficult to track down the location of the exception.
This commit is contained in:
parent
8dcde36d20
commit
217d780233
16 changed files with 43 additions and 35 deletions
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
XML_Node* x = get_XML_Node("#"+id, m_r);
|
XML_Node* x = get_XML_Node("#"+id, m_r);
|
||||||
if (!x) {
|
if (!x) {
|
||||||
throw CanteraError("Edge","error in get_XML_Node");
|
throw CanteraError("Edge::Edge","error in get_XML_Node");
|
||||||
}
|
}
|
||||||
|
|
||||||
importPhase(*x, this);
|
importPhase(*x, this);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public:
|
||||||
id = "";
|
id = "";
|
||||||
}
|
}
|
||||||
m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
|
m_ok = buildSolutionFromXML(*m_r, id, "phase", this, 0);
|
||||||
if (!m_ok) throw CanteraError("Metal",
|
if (!m_ok) throw CanteraError("Metal::Metal",
|
||||||
"buildSolutionFromXML returned false");
|
"buildSolutionFromXML returned false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ public:
|
||||||
if (n < data.size()) {
|
if (n < data.size()) {
|
||||||
return *data[n];
|
return *data[n];
|
||||||
} else {
|
} else {
|
||||||
throw Cantera::CanteraError("item","index out of range"+Cantera::int2str(n));
|
throw Cantera::CanteraError("Cabinet::item","index out of range"+Cantera::int2str(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ size_t Cantera::BasisOptimize(int* usedZeroedSpecies, bool doFormRxn,
|
||||||
vector_int ipiv(nComponents);
|
vector_int ipiv(nComponents);
|
||||||
ct_dgetrf(nComponents, nComponents, &sm[0], ne, &ipiv[0], info);
|
ct_dgetrf(nComponents, nComponents, &sm[0], ne, &ipiv[0], info);
|
||||||
if (info) {
|
if (info) {
|
||||||
throw CanteraError("basopt", "factorization returned an error condition");
|
throw CanteraError("BasisOptimize", "factorization returned an error condition");
|
||||||
}
|
}
|
||||||
ct_dgetrs(ctlapack::NoTranspose, nComponents, nNonComponents, &sm[0], ne,
|
ct_dgetrs(ctlapack::NoTranspose, nComponents, nNonComponents, &sm[0], ne,
|
||||||
&ipiv[0], &formRxnMatrix[0], ne, info);
|
&ipiv[0], &formRxnMatrix[0], ne, info);
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ void ChemEquil::update(const thermo_t& s)
|
||||||
for (size_t k = 0; k < m_kk; k++) {
|
for (size_t k = 0; k < m_kk; k++) {
|
||||||
m_elementmolefracs[m] += nAtoms(k,m) * m_molefractions[k];
|
m_elementmolefracs[m] += nAtoms(k,m) * m_molefractions[k];
|
||||||
if (m_molefractions[k] < 0.0) {
|
if (m_molefractions[k] < 0.0) {
|
||||||
throw CanteraError("update",
|
throw CanteraError("ChemEquil::update",
|
||||||
"negative mole fraction for "+s.speciesName(k)+
|
"negative mole fraction for "+s.speciesName(k)+
|
||||||
": "+fp2str(m_molefractions[k]));
|
": "+fp2str(m_molefractions[k]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -441,7 +441,7 @@ void MultiPhaseEquil::step(doublereal omega, vector_fp& deltaN,
|
||||||
{
|
{
|
||||||
size_t k, ik;
|
size_t k, ik;
|
||||||
if (omega < 0.0) {
|
if (omega < 0.0) {
|
||||||
throw CanteraError("step","negative omega");
|
throw CanteraError("MultiPhaseEquil::step","negative omega");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ik = 0; ik < m_nel; ik++) {
|
for (ik = 0; ik < m_nel; ik++) {
|
||||||
|
|
|
||||||
|
|
@ -552,7 +552,7 @@ double ElectrodeKinetics::calcForwardROP_BV(size_t irxn, size_t iBeta, double io
|
||||||
int iECDFormulation = m_ctrxn_ecdf[iBeta];
|
int iECDFormulation = m_ctrxn_ecdf[iBeta];
|
||||||
|
|
||||||
if (!iECDFormulation) {
|
if (!iECDFormulation) {
|
||||||
throw CanteraError("", "not handled yet");
|
throw CanteraError("ElectrodeKinetics::calcForwardROP_BV", "not handled yet");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Calculate the forward chemical and modify the forward reaction rate coefficient
|
// Calculate the forward chemical and modify the forward reaction rate coefficient
|
||||||
|
|
@ -611,7 +611,7 @@ double ElectrodeKinetics::calcForwardROP_BV(size_t irxn, size_t iBeta, double io
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (ioc > 0) {
|
if (ioc > 0) {
|
||||||
throw CanteraError(" ", "ioc should be less than zero here");
|
throw CanteraError("ElectrodeKinetics::calcForwardROP_BV", "ioc should be less than zero here");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
double exp2 = -nu * nStoich * Faraday * (1.0 - beta) / (rt);
|
double exp2 = -nu * nStoich * Faraday * (1.0 - beta) / (rt);
|
||||||
|
|
@ -645,7 +645,7 @@ double ElectrodeKinetics::calcForwardROP_BV_NoAct(size_t irxn, size_t iBeta, dou
|
||||||
int iECDFormulation = m_ctrxn_ecdf[iBeta];
|
int iECDFormulation = m_ctrxn_ecdf[iBeta];
|
||||||
|
|
||||||
if (!iECDFormulation) {
|
if (!iECDFormulation) {
|
||||||
throw CanteraError("", "not handled yet");
|
throw CanteraError("ElectrodeKinetics::calcForwardROP_BV_NoAct", "not handled yet");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Calculate the forward chemical and modify the forward reaction rate coefficient
|
// Calculate the forward chemical and modify the forward reaction rate coefficient
|
||||||
|
|
@ -712,7 +712,7 @@ double ElectrodeKinetics::calcForwardROP_BV_NoAct(size_t irxn, size_t iBeta, dou
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_MODE
|
#ifdef DEBUG_MODE
|
||||||
if (ioc > 0) {
|
if (ioc > 0) {
|
||||||
throw CanteraError(" ", "ioc should be less than zero here");
|
throw CanteraError("ElectrodeKinetics::calcForwardROP_BV_NoAct", "ioc should be less than zero here");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
double exp2 = -nu * nStoich * Faraday * (1.0 - beta) / (rt);
|
double exp2 = -nu * nStoich * Faraday * (1.0 - beta) / (rt);
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ void OneDim::save(const std::string& fname, std::string id,
|
||||||
}
|
}
|
||||||
ofstream s(fname.c_str());
|
ofstream s(fname.c_str());
|
||||||
if (!s) {
|
if (!s) {
|
||||||
throw CanteraError("save","could not open file "+fname);
|
throw CanteraError("OneDim::save","could not open file "+fname);
|
||||||
}
|
}
|
||||||
root.write(s);
|
root.write(s);
|
||||||
s.close();
|
s.close();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ Bdry1D::Bdry1D() : Domain1D(1, 1, 0.0),
|
||||||
void Bdry1D::_init(size_t n)
|
void Bdry1D::_init(size_t n)
|
||||||
{
|
{
|
||||||
if (m_index == npos) {
|
if (m_index == npos) {
|
||||||
throw CanteraError("Bdry1D",
|
throw CanteraError("Bdry1D::_init",
|
||||||
"install in container before calling init.");
|
"install in container before calling init.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ void Bdry1D::_init(size_t n)
|
||||||
m_left_nsp = m_left_nv - 4;
|
m_left_nsp = m_left_nv - 4;
|
||||||
m_phase_left = &m_flow_left->phase();
|
m_phase_left = &m_flow_left->phase();
|
||||||
} else
|
} else
|
||||||
throw CanteraError("Bdry1D::init",
|
throw CanteraError("Bdry1D::_init",
|
||||||
"Boundary domains can only be "
|
"Boundary domains can only be "
|
||||||
"connected on the left to flow domains, not type "+int2str(r.domainType())
|
"connected on the left to flow domains, not type "+int2str(r.domainType())
|
||||||
+ " domains.");
|
+ " domains.");
|
||||||
|
|
@ -66,7 +66,7 @@ void Bdry1D::_init(size_t n)
|
||||||
m_right_nsp = m_right_nv - 4;
|
m_right_nsp = m_right_nv - 4;
|
||||||
m_phase_right = &m_flow_right->phase();
|
m_phase_right = &m_flow_right->phase();
|
||||||
} else
|
} else
|
||||||
throw CanteraError("Bdry1D::init",
|
throw CanteraError("Bdry1D::_init",
|
||||||
"Boundary domains can only be "
|
"Boundary domains can only be "
|
||||||
"connected on the right to flow domains, not type "+int2str(r.domainType())
|
"connected on the right to flow domains, not type "+int2str(r.domainType())
|
||||||
+ " domains.");
|
+ " domains.");
|
||||||
|
|
|
||||||
|
|
@ -590,11 +590,13 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
||||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
||||||
//! Check to see if we have in fact found the inverse.
|
//! Check to see if we have in fact found the inverse.
|
||||||
if (anionList_[0] != k) {
|
if (anionList_[0] != k) {
|
||||||
throw CanteraError("", "neutral molecule calc error");
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
|
||||||
|
"neutral molecule calc error");
|
||||||
} else {
|
} else {
|
||||||
//! For the single anion case, we will allow some slippage
|
//! For the single anion case, we will allow some slippage
|
||||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-5) {
|
if (fabs(moleFractionsTmp_[k]) > 1.0E-5) {
|
||||||
throw CanteraError("", "neutral molecule calc error - anion");
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
|
||||||
|
"neutral molecule calc error - anion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -614,18 +616,18 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
||||||
|
|
||||||
case cIonSolnType_SINGLECATION:
|
case cIonSolnType_SINGLECATION:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions", "Unknown type");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cIonSolnType_MULTICATIONANION:
|
case cIonSolnType_MULTICATIONANION:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions", "Unknown type");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions", "Unknown type");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -688,11 +690,13 @@ void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const
|
||||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
if (fabs(moleFractionsTmp_[k]) > 1.0E-13) {
|
||||||
//! Check to see if we have in fact found the inverse.
|
//! Check to see if we have in fact found the inverse.
|
||||||
if (anionList_[0] != k) {
|
if (anionList_[0] != k) {
|
||||||
throw CanteraError("", "neutral molecule calc error");
|
throw CanteraError("IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
|
||||||
|
"neutral molecule calc error");
|
||||||
} else {
|
} else {
|
||||||
//! For the single anion case, we will allow some slippage
|
//! For the single anion case, we will allow some slippage
|
||||||
if (fabs(moleFractionsTmp_[k]) > 1.0E-5) {
|
if (fabs(moleFractionsTmp_[k]) > 1.0E-5) {
|
||||||
throw CanteraError("", "neutral molecule calc error - anion");
|
throw CanteraError("IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
|
||||||
|
"neutral molecule calc error - anion");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -714,18 +718,21 @@ void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const
|
||||||
|
|
||||||
case cIonSolnType_SINGLECATION:
|
case cIonSolnType_SINGLECATION:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
|
||||||
|
"Unknown type");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cIonSolnType_MULTICATIONANION:
|
case cIonSolnType_MULTICATIONANION:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
|
||||||
|
"Unknown type");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
throw CanteraError("eosType", "Unknown type");
|
throw CanteraError("IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads",
|
||||||
|
"Unknown type");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw CanteraError("", "not found");
|
throw CanteraError("LatticeSolidPhase::setParametersFromXML", "not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -745,12 +745,12 @@ int MixtureFugacityTP::phaseState(bool checkState) const
|
||||||
|
|
||||||
doublereal MixtureFugacityTP::densSpinodalLiquid() const
|
doublereal MixtureFugacityTP::densSpinodalLiquid() const
|
||||||
{
|
{
|
||||||
throw CanteraError("", "unimplemented");
|
throw CanteraError("MixtureFugacityTP::densSpinodalLiquid", "unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
doublereal MixtureFugacityTP::densSpinodalGas() const
|
doublereal MixtureFugacityTP::densSpinodalGas() const
|
||||||
{
|
{
|
||||||
throw CanteraError("", "unimplemented");
|
throw CanteraError("MixtureFugacityTP::densSpinodalGas", "unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
doublereal MixtureFugacityTP::satPressure(doublereal TKelvin)
|
doublereal MixtureFugacityTP::satPressure(doublereal TKelvin)
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) :
|
||||||
"Unable to find Li2Fe1S2(S)");
|
"Unable to find Li2Fe1S2(S)");
|
||||||
}
|
}
|
||||||
m_pSpecies_B_ij[0] = iLi2;
|
m_pSpecies_B_ij[0] = iLi2;
|
||||||
throw CanteraError("", "unimplemented");
|
throw CanteraError("PhaseCombo_Interaction test1 constructor", "unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -665,7 +665,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const
|
||||||
dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
|
dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
|
||||||
dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
|
dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
|
||||||
}
|
}
|
||||||
throw CanteraError("", "unimplemented");
|
throw CanteraError("PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag", "unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,8 @@ RedlichKwongMFTP::RedlichKwongMFTP(int testProb) :
|
||||||
infile = "co2_redlichkwong.xml";
|
infile = "co2_redlichkwong.xml";
|
||||||
id_ = "carbondioxide";
|
id_ = "carbondioxide";
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("", "test prob = 1 only");
|
throw CanteraError("RedlichKwongMFTP::RedlichKwongMFTP(int testProb)",
|
||||||
|
"test prob = 1 only");
|
||||||
}
|
}
|
||||||
XML_Node* root = get_XML_File(infile);
|
XML_Node* root = get_XML_File(infile);
|
||||||
if (id_ == "-") {
|
if (id_ == "-") {
|
||||||
|
|
@ -213,7 +214,7 @@ doublereal RedlichKwongMFTP::cp_mole() const
|
||||||
|
|
||||||
doublereal RedlichKwongMFTP::cv_mole() const
|
doublereal RedlichKwongMFTP::cv_mole() const
|
||||||
{
|
{
|
||||||
throw CanteraError("", "unimplemented");
|
throw CanteraError("RedlichKwongMFTP::cv_mole", "unimplemented");
|
||||||
return cp_mole() - GasConstant;
|
return cp_mole() - GasConstant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -850,7 +851,7 @@ void RedlichKwongMFTP::readXMLPureFluid(XML_Node& pureFluidParam)
|
||||||
m_formTempParam = 1;
|
m_formTempParam = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("", "unknown model");
|
throw CanteraError("RedlichKwongMFTP::readXMLPureFluid", "unknown model");
|
||||||
}
|
}
|
||||||
|
|
||||||
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
|
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
|
||||||
|
|
@ -941,7 +942,7 @@ void RedlichKwongMFTP::readXMLCrossFluid(XML_Node& CrossFluidParam)
|
||||||
m_formTempParam = 1;
|
m_formTempParam = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("", "unknown model");
|
throw CanteraError("RedlichKwongMFTP::readXMLCrossFluid", "unknown model");
|
||||||
}
|
}
|
||||||
|
|
||||||
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
|
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ LTPspecies* TransportFactory::newLTP(const XML_Node& trNode, const std::string&
|
||||||
ltps = new LTPspecies_ExpT(trNode, name, tp_ind, thermo);
|
ltps = new LTPspecies_ExpT(trNode, name, tp_ind, thermo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("newLTP","unknown transport model: " + model);
|
throw CanteraError("TransportFactory::newLTP","unknown transport model: " + model);
|
||||||
ltps = new LTPspecies(&trNode, name, tp_ind, thermo);
|
ltps = new LTPspecies(&trNode, name, tp_ind, thermo);
|
||||||
}
|
}
|
||||||
return ltps;
|
return ltps;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
size_t nsp = solid->nSpecies();
|
size_t nsp = solid->nSpecies();
|
||||||
if (nsp != 1) {
|
if (nsp != 1) {
|
||||||
throw CanteraError("","Should just be one species");
|
throw CanteraError("main","Should just be one species");
|
||||||
}
|
}
|
||||||
string sName;
|
string sName;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue