How to use sol.retcode to catch ODE instability?

I would like to make an interactive plot with GLMakie. There are some instances when the ODEs generate instability. I would like to plot a label “INSTABILITY DETECTED” in the plot itself when instability occurs.
I understand this can be achieved with sol.retcode but what would be the implementation?
I should set an observable for retcode, then some text that can be written and deleted on the plot when needed.
I could not find an example of an instable ODE and the instability comes out only some times, so it is difficult to provide a working example.
Thank you

You would just check SciMLBase.successful_retcode(sol) or sol.retcode and throw a message based on the returned enum

Thank you, I wrote something along this line:

data = lift(p_mod) do p_new
    prob = ODEProblem(odeSolver!, u0, tspan, parms)
    return solve(prob, Rosenbrock23(), p = p_new, saveat = R)
    test_instability = sol.retcode
    if test_instability 
        text!(fig, position =  Point2f( 20, 0), "Instability detected", fontsize = 30)
    end
end

Would that be enough? The code works without error but I am unsure if I am hitting an instability given that I got

Warning: At t=0.0, dt was forced below floating point epsilon 5.0e-324, and step error estimate = NaN. Aborting. There is either an error in your model specification or the true solution is unstable (or the true solution can not be represented in the precision of Float64).

on REPL

No, if sol.retcode doesn’t mean anything because the return is not a Boolean. Read my previous post