From 64437bba76e1819b14838c489e69749153efa6f3 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 9 Dec 2017 15:33:54 +0100 Subject: [PATCH] use assert instead of throw std:logic_error --- src/kernel/activity/ExecImpl.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/kernel/activity/ExecImpl.cpp b/src/kernel/activity/ExecImpl.cpp index 9dba149c18..e394bdd431 100644 --- a/src/kernel/activity/ExecImpl.cpp +++ b/src/kernel/activity/ExecImpl.cpp @@ -43,15 +43,11 @@ void simgrid::kernel::activity::ExecImpl::resume() double simgrid::kernel::activity::ExecImpl::remains() { - static std::logic_error e( - "The remaining work on parallel tasks cannot be defined as a scalar amount of flops (it's a vector). " - "So parallel_task->remains() is not defined. " - "You are probably looking for parallel_task->remainingRatio()."); + xbt_assert(host_ != nullptr, "Calling remains() on a parallel execution is not allowed. " + "We would need to return a vector instead of a scalar. " + "Did you meant remainingRatio() instead?"); - if (host_ == nullptr) // parallel task: their remain is not in flops (we'd need a vector for that, not a scalar) - throw &e; - else // sequential task: everything's fine - return surfAction_->getRemains(); + return surfAction_->getRemains(); } double simgrid::kernel::activity::ExecImpl::remainingRatio() { -- 2.20.1