Skip to content

Commit 9c22374

Browse files
Update return code documentation to reflect enum implementation (fixes #734)
- Update retcode documentation to explain they are now enum values, not symbols - Add proper usage example with SciMLBase.successful_retcode(sol) - Add warning about deprecated sol.retcode == :Success pattern - Fix incorrect usage in FAQ (was sol.retcode, should be just sol) - Add link to SciMLBase ReturnCode documentation for complete reference This addresses the issue where the documentation was outdated and still described return codes as symbols instead of the current enum implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7bc71f7 commit 9c22374

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

docs/src/basics/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ the solution quickly diverges to infinity! This means, double-check your paramet
3232
are indexed correctly!
3333

3434
**Note: if you see these warnings during a parameter estimation process, this is
35-
likely the underlying problem. Simply check `SciMLBase.successful_retcode(sol.retcode)` and throw
35+
likely the underlying problem. Simply check `SciMLBase.successful_retcode(sol)` and throw
3636
an `Inf` cost. Most optimizers will then reject steps in those parameter regimes!**
3737

3838
There are a few other things to check as well. Often, the stability of

docs/src/basics/solution.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,38 @@ 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. Use `SciMLBase.successful_retcode(sol)` instead.
196+
197+
The return codes include:
198+
199+
- `Default`: The solver did not set retcodes.
200+
- `Success`: The integration completed without erroring or the steady state solver
189201
from `SteadyStateDiffEq` found the steady state.
190-
- `:Terminated`: The integration is terminated with `terminate!(integrator)`.
202+
- `Terminated`: The integration is terminated with `terminate!(integrator)`.
191203
Note that this may occur by using `TerminateSteadyState` from the callback
192204
library `DiffEqCallbacks`.
193-
- `:MaxIters`: The integration exited early because it reached its maximum number
205+
- `MaxIters`: The integration exited early because it reached its maximum number
194206
of iterations.
195-
- `:DtLessThanMin`: The timestep method chose a stepsize which is smaller than the
207+
- `DtLessThanMin`: The timestep method chose a stepsize which is smaller than the
196208
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.
209+
- `Unstable`: The solver detected that the solution was unstable and exited early.
210+
- `InitialFailure`: The DAE solver could not find consistent initial conditions.
211+
- `ConvergenceFailure`: The internal implicit solvers failed to converge.
212+
- `Failure`: General uncategorized failures or errors.
213+
214+
For a complete list of return codes and their properties, see the
215+
[SciMLBase ReturnCode documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes).
201216

202217
## Problem-Specific Features
203218

0 commit comments

Comments
 (0)