use eoExceptions everywhere

This commit is contained in:
Johann Dreo 2020-03-27 00:21:52 +01:00
commit eba2e14950
127 changed files with 524 additions and 418 deletions

View file

@ -183,7 +183,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
else
{
std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
throw std::runtime_error(stmp.c_str());
throw eoException(stmp.c_str());
}
_state.storeFunctor(select);
@ -260,7 +260,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
}
else
{
throw std::runtime_error("Sorry, only deterministic tournament available at the moment");
throw eoException("Sorry, only deterministic tournament available at the moment");
}
}
ptReplace = new eoMGGReplacement<EOT>(-surviveParents, tSize);
@ -341,7 +341,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
}
else // no replacement recognized
{
throw std::runtime_error("Invalid replacement type " + replacementParam.first);
throw eoException("Invalid replacement type " + replacementParam.first);
}
ptReplace = & make_general_replacement<EOT>(

View file

@ -120,7 +120,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
else // parameter passed by user as DetTour(T)
nicheSize = atof(ppSelect.second[0].c_str());
if (_dist == NULL) // no distance
throw std::runtime_error("You didn't specify a distance when calling make_algo_scalar and using sharing");
throw eoException("You didn't specify a distance when calling make_algo_scalar and using sharing");
select = new eoSharingSelect<EOT>(nicheSize, *_dist);
}
else if (ppSelect.first == std::string("StochTour"))
@ -206,7 +206,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
else
{
std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
throw std::runtime_error(stmp.c_str());
throw eoException(stmp.c_str());
}
_state.storeFunctor(select);
@ -282,7 +282,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
else
{
std::string stmp = std::string("Invalid replacement: ") + ppReplace.first;
throw std::runtime_error(stmp.c_str());
throw eoException(stmp.c_str());
}
_state.storeFunctor(replace);

View file

@ -156,7 +156,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
// now check that there is at least one!
if (!continuator)
throw std::runtime_error("You MUST provide a stopping criterion");
throw eoException("You MUST provide a stopping criterion");
// OK, it's there: store in the eoState
_state.storeFunctor(continuator);

View file

@ -97,7 +97,7 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
{
p = atof(_ppReduce.second[0].c_str());
if ( (p<=0.5) || (p>1) )
throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
throw eoException("Stochastic tournament size should be in [0.5,1]");
}
ptReduce = new eoStochTournamentTruncate<EOT>(p);
@ -110,7 +110,7 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
}
else // no known reduction entered
{
throw std::runtime_error("Unknown reducer: " + _ppReduce.first);
throw eoException("Unknown reducer: " + _ppReduce.first);
}
// all done, stores and return a reference
_state.storeFunctor(ptReduce);