From 462b6ec7db7313c65610eebb3bdc11e6f569c644 Mon Sep 17 00:00:00 2001 From: Daniel Bridenbecker Date: Fri, 20 Dec 2024 12:39:43 -0800 Subject: [PATCH] GH-75 - AgeDistribution: Poor error message for Array of Arrays (#76) --- Eradication/NodeDemographics.cpp | 8 ++++---- componentTests/NodeDemographicsTest.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Eradication/NodeDemographics.cpp b/Eradication/NodeDemographics.cpp index 18e8aee83..988ea050b 100644 --- a/Eradication/NodeDemographics.cpp +++ b/Eradication/NodeDemographics.cpp @@ -1350,18 +1350,18 @@ void NodeDemographicsDistribution::CheckIsArrayOfValues( const std::string& rDis std::stringstream ss; ss << "\nERROR: Unexpected type while parsing '" << parameterName << "'\n"; ss << "in distribution '" << rDistributionName << "' for nodeID = " << nodeId << ".\n"; - ss << "Expected an array of floats but detected "; + ss << "Expected an array of floats but detected an array of "; if( rArray[ zero ].IsArray() ) { - ss << " an array."; + ss << "arrays."; } else if( rArray[ zero ].IsObject() ) { - ss << " an object/dictionary."; + ss << "objects/dictionaries."; } else { - ss << " unknown"; + ss << "unknown"; } throw NodeDemographicsFormatErrorException( __FILE__, __LINE__, __FUNCTION__, ss.str().c_str() ); } diff --git a/componentTests/NodeDemographicsTest.cpp b/componentTests/NodeDemographicsTest.cpp index 11f4e1386..0a486751b 100644 --- a/componentTests/NodeDemographicsTest.cpp +++ b/componentTests/NodeDemographicsTest.cpp @@ -625,7 +625,7 @@ SUITE(NodeDemographicsTest) { std::vector axis_names ; TestHelper_DistributionFormatException( __LINE__, "demographics_TestDistAgeDisttNumResultValuesNotMatchDistValuesC_DoubleArray.json", "AgeDistribution", axis_names, - "ERROR: Unexpected type while parsing 'ResultValues'\nin distribution 'AgeDistribution' for nodeID = 1.\nExpected an array of floats but detected an array.)" ); + "ERROR: Unexpected type while parsing 'ResultValues'\nin distribution 'AgeDistribution' for nodeID = 1.\nExpected an array of floats but detected an array of arrays.)" ); } TEST_FIXTURE(NodeDemographicsFactoryFixture, TestDistFertDistInvalidNumAxisNames)