Skip to content

Commit 7f9dd30

Browse files
Merge pull request #771 from jClugstor/solution_strip_error
use custom exception for lazy interpolation
2 parents 2c3c46d + f8ee074 commit 7f9dd30

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/solutions/ode_solutions.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,15 @@ function sensitivity_solution(sol::ODESolution, u, t)
605605
return @set sol.interp = interp
606606
end
607607

608+
struct LazyInterpolationException <: Exception
609+
var::Symbol
610+
end
611+
612+
Base.showerror(io::IO, e::LazyInterpolationException) = print(io, "The algorithm", e.var, " uses lazy interpolation, which is incompatible with `strip_solution`.")
613+
608614
function strip_solution(sol::ODESolution)
609615
if has_lazy_interpolation(sol.alg)
610-
error("The algorithm $(sol.alg) uses lazy interpolation, which is incompatible with
611-
solution stripping.")
616+
throw(LazyInterpolationException(nameof(typeof(sol.alg))))
612617
end
613618

614619
interp = strip_interpolation(sol.interp)

0 commit comments

Comments
 (0)