use eoExceptions everywhere
This commit is contained in:
parent
75ac37b02a
commit
eba2e14950
127 changed files with 524 additions and 418 deletions
|
|
@ -115,13 +115,13 @@ PyEO& pop_getitem(eoPop<PyEO>& pop, boost::python::object key)
|
|||
{
|
||||
boost::python::extract<int> x(key);
|
||||
if (!x.check())
|
||||
throw index_error("Slicing not allowed");
|
||||
throw eoException("Slicing not allowed");
|
||||
|
||||
int i = x();
|
||||
|
||||
if (static_cast<unsigned>(i) >= pop.size())
|
||||
{
|
||||
throw index_error("Index out of bounds");
|
||||
throw eoException("Index out of bounds");
|
||||
}
|
||||
return pop[i];
|
||||
}
|
||||
|
|
@ -130,13 +130,13 @@ void pop_setitem(eoPop<PyEO>& pop, boost::python::object key, PyEO& value)
|
|||
{
|
||||
boost::python::extract<int> x(key);
|
||||
if (!x.check())
|
||||
throw index_error("Slicing not allowed");
|
||||
throw eoException("Slicing not allowed");
|
||||
|
||||
int i = x();
|
||||
|
||||
if (static_cast<unsigned>(i) >= pop.size())
|
||||
{
|
||||
throw index_error("Index out of bounds");
|
||||
throw eoException("Index out of bounds");
|
||||
}
|
||||
|
||||
pop[i] = value;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public :
|
|||
{
|
||||
if (which >= objective_info.size())
|
||||
{
|
||||
throw index_error("Too few elements allocated, resize objectives first");
|
||||
throw eoException("Too few elements allocated, resize objectives first");
|
||||
}
|
||||
|
||||
objective_info[which] = value;
|
||||
|
|
@ -70,7 +70,7 @@ public :
|
|||
boost::python::extract<double> x(object::operator[](i));
|
||||
|
||||
if (!x.check())
|
||||
throw std::runtime_error("PyFitness: does not contain doubles");
|
||||
throw eoException("PyFitness: does not contain doubles");
|
||||
return x();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
{
|
||||
if (static_cast<unsigned>(i) >= vec.size())
|
||||
{
|
||||
throw index_error("Index out of bounds");
|
||||
throw eoException("Index out of bounds");
|
||||
}
|
||||
|
||||
return vec[i]->getValue();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const PyEO& popview_getitem(const std::vector<const PyEO*>& pop, int it)
|
|||
{
|
||||
unsigned item = unsigned(it);
|
||||
if (item > pop.size())
|
||||
throw index_error("too much");
|
||||
throw eoException("too much");
|
||||
|
||||
return *pop[item];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void setv< std::vector<double>, numeric::array >
|
|||
{
|
||||
extract<double> x(val[i]);
|
||||
if (!x.check())
|
||||
throw std::runtime_error("double expected");
|
||||
throw eoException("double expected");
|
||||
|
||||
v[i] = x();
|
||||
}
|
||||
|
|
@ -130,9 +130,9 @@ void setv< std::pair<double, double>, tuple >
|
|||
extract<double> second(val[1]);
|
||||
|
||||
if (!first.check())
|
||||
throw std::runtime_error("doubles expected");
|
||||
throw eoException("doubles expected");
|
||||
if (!second.check())
|
||||
throw std::runtime_error("doubles expected");
|
||||
throw eoException("doubles expected");
|
||||
|
||||
p.value().first = first();
|
||||
p.value().second = second();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue