diff --git a/core/include/moveit/task_constructor/stage_p.h b/core/include/moveit/task_constructor/stage_p.h index 7e51458c..87ed7b27 100644 --- a/core/include/moveit/task_constructor/stage_p.h +++ b/core/include/moveit/task_constructor/stage_p.h @@ -152,7 +152,11 @@ public: void runCompute() { ROS_DEBUG_STREAM_NAMED("Stage", "Computing stage '" << name() << "'"); auto compute_start_time = std::chrono::steady_clock::now(); - compute(); + try { + compute(); + } catch (const Property::error& e) { + me()->reportPropertyError(e); + } auto compute_stop_time = std::chrono::steady_clock::now(); total_compute_time_ += compute_stop_time - compute_start_time; } diff --git a/core/src/container.cpp b/core/src/container.cpp index 470017bd..52016014 100644 --- a/core/src/container.cpp +++ b/core/src/container.cpp @@ -643,14 +643,9 @@ bool SerialContainer::canCompute() const { void SerialContainer::compute() { for (const auto& stage : pimpl()->children()) { - try { - if (!stage->pimpl()->canCompute()) - continue; - - stage->pimpl()->runCompute(); - } catch (const Property::error& e) { - stage->reportPropertyError(e); - } + if (!stage->pimpl()->canCompute()) + continue; + stage->pimpl()->runCompute(); } } @@ -781,11 +776,7 @@ bool WrapperBase::canCompute() const { } void WrapperBase::compute() { - try { - wrapped()->pimpl()->runCompute(); - } catch (const Property::error& e) { - wrapped()->reportPropertyError(e); - } + wrapped()->pimpl()->runCompute(); } bool Alternatives::canCompute() const { @@ -797,11 +788,7 @@ bool Alternatives::canCompute() const { void Alternatives::compute() { for (const auto& stage : pimpl()->children()) { - try { - stage->pimpl()->runCompute(); - } catch (const Property::error& e) { - stage->reportPropertyError(e); - } + stage->pimpl()->runCompute(); } } @@ -840,11 +827,7 @@ void Fallbacks::compute() { if (!active_child_) return; - try { - active_child_->pimpl()->runCompute(); - } catch (const Property::error& e) { - active_child_->reportPropertyError(e); - } + active_child_->pimpl()->runCompute(); } void Fallbacks::onNewSolution(const SolutionBase& s) { @@ -894,11 +877,7 @@ bool Merger::canCompute() const { void Merger::compute() { for (const auto& stage : pimpl()->children()) { - try { - stage->pimpl()->runCompute(); - } catch (const Property::error& e) { - stage->reportPropertyError(e); - } + stage->pimpl()->runCompute(); } }