[Positioning] Positioning: catch compute exceptions

Catch the exception potentially thrown by
PositioningAlgorithm::compute().
This commit is contained in:
Matteo Cypriani 2011-06-29 17:33:44 +02:00
parent 0df91eaa94
commit d43267fcd3
1 changed files with 16 additions and 1 deletions

View File

@ -97,7 +97,21 @@ void Positioning::loop()
for (algo = algorithms.begin() ; algo != algorithms.end() ;
++algo)
{
Result res((*algo)->compute(request)) ;
Result res ;
try
{
res = (*algo)->compute(request) ;
}
catch (exception &e)
{
cerr
<< "Cannot compute with algorithm "
<< (*algo)->get_name() << ": « "
<< e.what() << " »\n" ;
continue ;
}
if (compute_error)
res.compute_error(real_position) ;
else if ((*algo)->get_name() == "Real")
@ -105,6 +119,7 @@ void Positioning::loop()
compute_error = true ;
real_position = res.get_position() ;
}
results.add(res) ;
}