Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit 2d2dbbe

Browse files
committed
Include time in error message, if simulation failed
1 parent f6ea780 commit 2d2dbbe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/SimulateAndPlot.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,15 @@ function simulate!(m::SimulationModel{FloatType,ParType,EvaluatedParType,TimeTyp
349349
m.algorithmName = getAlgorithmName(solution.alg)
350350
end
351351

352-
# Raise an error, if simulation was not successful
353-
if !ismissing(solution) && !(solution.retcode == :Default || solution.retcode == :Success || solution.retcode == :Terminated)
354-
error("\nsolution = simulate!(", m.modelName, ", ...) failed with solution.retcode = :$(solution.retcode).\n")
355-
end
356-
357352
# Terminate simulation
358353
finalStates = solution.u[end]
359-
finalTime = solution.t[end]
354+
finalTime = solution.t[end]
360355
terminate!(m, finalStates, finalTime)
356+
357+
# Raise an error, if simulation was not successful
358+
if !(solution.retcode == :Default || solution.retcode == :Success || solution.retcode == :Terminated)
359+
error("\nsolution = simulate!(", m.modelName, ", ...) failed with solution.retcode = :$(solution.retcode) at time = $finalTime.\n")
360+
end
361361
end
362362
disable_timer!(m.timer)
363363

0 commit comments

Comments
 (0)