@@ -503,7 +503,10 @@ std::unordered_map<Shared<const CoordinateSubset>, bool> State::isNear(
503503{
504504 if (aToleranceMap.size () != coordinatesBrokerSPtr_->accessSubsets ().getSize ())
505505 {
506- throw ostk::core::error::runtime::Wrong (" Tolerance Map" );
506+ throw ostk::core::error::runtime::Wrong (
507+ " Tolerance Map: Expected size [" + std::to_string (coordinatesBrokerSPtr_->accessSubsets ().getSize ()) +
508+ " ], but received size [" + std::to_string (aToleranceMap.size ()) + " ]."
509+ );
507510 }
508511
509512 const State deltaState = aState - *this ;
@@ -513,11 +516,15 @@ std::unordered_map<Shared<const CoordinateSubset>, bool> State::isNear(
513516 {
514517 if (!coordinatesBrokerSPtr_->hasSubset (subsetSPtr))
515518 {
516- throw ostk::core::error::runtime::Wrong (" Tolerance Map Coordinate Subset" );
519+ throw ostk::core::error::runtime::Wrong (
520+ " Tolerance map doesn't contain coordinate subset [" + subsetSPtr->getName () + " ]."
521+ );
517522 }
518523 if (tolerance <= 0.0 )
519524 {
520- throw ostk::core::error::runtime::Wrong (" Tolerance" );
525+ throw ostk::core::error::runtime::Wrong (
526+ " Tolerance value for subset [" + subsetSPtr->getName () + " ] is less than or equal to zero."
527+ );
521528 }
522529
523530 const VectorXd deltaCoordinates = deltaState.extractCoordinate (subsetSPtr);
@@ -533,7 +540,7 @@ std::unordered_map<Shared<const CoordinateSubset>, Array<bool>> State::isNear(
533540{
534541 if (aToleranceArrayMap.size () != coordinatesBrokerSPtr_->accessSubsets ().getSize ())
535542 {
536- throw ostk::core::error::runtime::Wrong (" Tolerance Map " );
543+ throw ostk::core::error::runtime::Wrong (" Tolerance array map is not of the same size as the state. " );
537544 }
538545
539546 const State deltaState = aState - *this ;
@@ -543,18 +550,26 @@ std::unordered_map<Shared<const CoordinateSubset>, Array<bool>> State::isNear(
543550 {
544551 if (!coordinatesBrokerSPtr_->hasSubset (subsetSPtr))
545552 {
546- throw ostk::core::error::runtime::Wrong (" Tolerance Map Coordinate Subset" );
553+ throw ostk::core::error::runtime::Wrong (
554+ " Tolerance array map doesn't contain coordinate subset [" + subsetSPtr->getName () + " ]."
555+ );
547556 }
548557
549558 const VectorXd deltaCoordinates = deltaState.extractCoordinate (subsetSPtr);
550559
551560 if (toleranceArray.size () != deltaCoordinates.size ())
552561 {
553- throw ostk::core::error::runtime::Wrong (" Tolerance Array Size" );
562+ throw ostk::core::error::runtime::Wrong (
563+ " Tolerance Array Size: Expected [" + std::to_string (deltaCoordinates.size ()) + " ], but got [" +
564+ std::to_string (toleranceArray.size ()) + " ]"
565+ );
554566 }
555567 if ((toleranceArray.array () <= 0.0 ).any ())
556568 {
557- throw ostk::core::error::runtime::Wrong (" Tolerance Array" );
569+ throw ostk::core::error::runtime::Wrong (
570+ " One or more elements in the tolerance array for subset [" + subsetSPtr->getName () +
571+ " ] is less than or equal to zero."
572+ );
558573 }
559574
560575 Array<bool > isNearArray;
0 commit comments