@@ -181,23 +181,41 @@ SciMLBase.DEStats
181181
182182## [ Return Codes (RetCodes)] (@id retcodes)
183183
184- The solution types have a ` retcode ` field which returns a symbol signifying the
185- error state of the solution. The retcodes are as follows:
184+ The solution types have a ` retcode ` field which returns an enum value signifying the
185+ error state of the solution. Return codes are now implemented as an enum using EnumX.jl
186+ rather than symbols.
186187
187- - ` :Default ` : The solver did not set retcodes.
188- - ` :Success ` : The integration completed without erroring or the steady state solver
188+ To check if a solution was successful, use:
189+ ``` julia
190+ SciMLBase. successful_retcode (sol)
191+ ```
192+
193+ !!! warning
194+ Previous iterations of the interface suggested using ` sol.retcode == :Success ` ,
195+ however, that is now not advised because there are more than one return code that can be interpreted
196+ as successful. For example, ` Terminated ` is a successful run to a manual termination, and would be missed
197+ if only checking for Success. Therefore we highly recommend you use ` SciMLBase.successful_retcode(sol) ` instead.
198+
199+ The return codes include are accessed via the ReturnCode module, i.e. ` SciMLBase.ReturnCode.Success ` . The
200+ following are major return codes to know:
201+
202+ - ` Default ` : The solver did not set retcodes.
203+ - ` Success ` : The integration completed without erroring or the steady state solver
189204 from ` SteadyStateDiffEq ` found the steady state.
190- - ` : Terminated` : The integration is terminated with ` terminate!(integrator) ` .
205+ - ` Terminated ` : The integration is terminated with ` terminate!(integrator) ` .
191206 Note that this may occur by using ` TerminateSteadyState ` from the callback
192207 library ` DiffEqCallbacks ` .
193- - ` : MaxIters` : The integration exited early because it reached its maximum number
208+ - ` MaxIters ` : The integration exited early because it reached its maximum number
194209 of iterations.
195- - ` : DtLessThanMin` : The timestep method chose a stepsize which is smaller than the
210+ - ` DtLessThanMin ` : The timestep method chose a stepsize which is smaller than the
196211 allowed minimum timestep, and exited early.
197- - ` :Unstable ` : The solver detected that the solution was unstable and exited early.
198- - ` :InitialFailure ` : The DAE solver could not find consistent initial conditions.
199- - ` :ConvergenceFailure ` : The internal implicit solvers failed to converge.
200- - ` :Failure ` : General uncategorized failures or errors.
212+ - ` Unstable ` : The solver detected that the solution was unstable and exited early.
213+ - ` InitialFailure ` : The DAE solver could not find consistent initial conditions.
214+ - ` ConvergenceFailure ` : The internal implicit solvers failed to converge.
215+ - ` Failure ` : General uncategorized failures or errors.
216+
217+ For a complete list of return codes and their properties, see the
218+ [ SciMLBase ReturnCode documentation] ( https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes ) .
201219
202220## Problem-Specific Features
203221
0 commit comments