From 45f6e84ebf245f7cb77ad54567abed510f9eb3f6 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 10 Jul 2014 22:36:43 +0000 Subject: [PATCH] Improved error messages that just reported 'confused' --- include/cantera/thermo/SpeciesThermoMgr.h | 2 +- src/thermo/LatticeSolidPhase.cpp | 3 ++- src/thermo/MixtureFugacityTP.cpp | 3 ++- src/thermo/NasaThermo.cpp | 12 +++++++----- src/thermo/Phase.cpp | 6 +++--- src/thermo/ShomateThermo.h | 14 +++++++++----- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index 8d9e1e6f9..db131e2bc 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -213,7 +213,7 @@ SpeciesThermoDuo::reportParams(size_t index, int& type, m_thermo2.reportParams(index, type, c, minTemp_, maxTemp_, refPressure_); } else { - throw CanteraError(" ", "confused"); + throw CanteraError("SpeciesThermoDuo", "mismatched SpeciesThermoInterpType"); } } diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 9977ccd5e..02da763ff 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -378,7 +378,8 @@ void LatticeSolidPhase::installSlavePhases(Cantera::XML_Node* phaseNode) std::string oldEname = lp->elementName(m); size_t newIndex = elementIndex(oldEname); if (newIndex == npos) { - throw CanteraError("LatticeSolidPhase::installSlavePhases", "confused"); + throw CanteraError("LatticeSolidPhase::installSlavePhases", + "element not found"); } ecomp[newIndex] = constArr[m]; } diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index 3ef243f16..1171056f2 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -577,7 +577,8 @@ doublereal MixtureFugacityTP::densityCalc(doublereal TKelvin, doublereal presPa, */ if (dpdVBase >= 0.0) { if (TKelvin > tcrit) { - throw CanteraError("", "confused"); + throw CanteraError("MixtureFugacityTP::densityCalc", + "T > tcrit unexpectedly"); } /* * TODO Spawn a calculation for the value of the spinodal point that is diff --git a/src/thermo/NasaThermo.cpp b/src/thermo/NasaThermo.cpp index a90e25d22..1a789bd98 100644 --- a/src/thermo/NasaThermo.cpp +++ b/src/thermo/NasaThermo.cpp @@ -187,21 +187,23 @@ void NasaThermo::reportParams(size_t index, int& type, lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure, c + 1); if (n != index) { - throw CanteraError(" ", "confused"); + throw CanteraError("NasaThermo::reportParams", "Index mismatch"); } if (itype != NASA1) { - throw CanteraError(" ", "confused"); + throw CanteraError("NasaThermo::reportParams", + "Thermo type mismatch for low-T polynomial"); } highPoly->reportParameters(n, itype, ttemp, maxTemp, refPressure, c + 8); if (n != index) { - throw CanteraError(" ", "confused"); + throw CanteraError("NasaThermo::reportParams", "Index mismatch"); } if (itype != NASA1) { - throw CanteraError(" ", "confused"); + throw CanteraError("NasaThermo::reportParams", + "Thermo type mismatch for high-T polynomial"); } } else { - throw CanteraError(" ", "confused"); + throw CanteraError("NasaThermo::reportParams", "Thermo type mismatch"); } } diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 6dd777c61..ed96236bc 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -137,10 +137,10 @@ void Phase::setXMLdata(XML_Node& xmlPhase) } m_xml = findXMLPhase(root_xml, iidd); if (!m_xml) { - throw CanteraError("Phase::setXMLdata()", "confused"); + throw CanteraError("Phase::setXMLdata()", "XML 'phase' node not found"); } if (&(m_xml->root()) != root_xml) { - throw CanteraError("Phase::setXMLdata()", "confused"); + throw CanteraError("Phase::setXMLdata()", "Root XML node not found"); } } @@ -835,7 +835,7 @@ size_t Phase::addUniqueElementAfterFreeze(const std::string& symbol, m_elementsFrozen = true; ii = elementIndex(symbol); if (ii != m_mm-1) { - throw CanteraError("Phase::addElementAfterFreeze()", "confused"); + throw CanteraError("Phase::addElementAfterFreeze()", "index error"); } if (m_kk > 0) { vector_fp old(m_speciesComp); diff --git a/src/thermo/ShomateThermo.h b/src/thermo/ShomateThermo.h index 814694b3c..f029dead2 100644 --- a/src/thermo/ShomateThermo.h +++ b/src/thermo/ShomateThermo.h @@ -305,21 +305,25 @@ public: lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure, c + 1); if (n != index) { - throw CanteraError(" ", "confused"); + throw CanteraError("ShomateThermo::reportParams", + "Index mismatch in low-T polynomial"); } if (itype != SHOMATE && itype != SHOMATE1) { - throw CanteraError(" ", "confused"); + throw CanteraError("ShomateThermo::reportParams", + "Thermo type mismatch in low-T polynomial"); } highPoly->reportParameters(n, itype, ttemp, maxTemp, refPressure, c + 8); if (n != index) { - throw CanteraError(" ", "confused"); + throw CanteraError("ShomateThermo::reportParams", + "Index mismatch in high-T polynomial"); } if (itype != SHOMATE && itype != SHOMATE1) { - throw CanteraError(" ", "confused"); + throw CanteraError("ShomateThermo::reportParams", + "Thermo type mismatch in high-T polynomial"); } } else { - throw CanteraError(" ", "confused"); + throw CanteraError("ShomateThermo::reportParams", "Thermo type mismatch"); } }