Skip to content

Commit

Permalink
GH-75 - AgeDistribution: Poor error message for Array of Arrays (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bridenbecker authored Dec 20, 2024
1 parent 413e13e commit 462b6ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Eradication/NodeDemographics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
Expand Down
2 changes: 1 addition & 1 deletion componentTests/NodeDemographicsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ SUITE(NodeDemographicsTest)
{
std::vector<std::string> 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)
Expand Down

0 comments on commit 462b6ec

Please sign in to comment.