Skip to content

Move error logging from SciMLBase to DiffEqBase - #1504

Merged
ChrisRackauckas merged 14 commits into
SciML:masterfrom
Shreyas-Ekanathan:logging
Aug 18, 2026
Merged

ChrisRackauckas merged 14 commits into
SciML:masterfrom
Shreyas-Ekanathan:logging

Conversation

@Shreyas-Ekanathan

Copy link
Copy Markdown
Contributor

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

A follow-up PR will be opened to OrdinaryDiffEq for the second half of this work.

Comment on lines +903 to +920
"""
report_integrator_failure(integrator, ::Val{reason})

Report a failure mode detected,called immediately
before the corresponding return code is returned. `reason` is one
of `:dt_NaN`, `:max_iters`, `:dt_min_unstable`, `:dt_epsilon`, `:instability` or
`:newton_convergence`.

`check_error` only detects failures; describing them belongs to the solver stack,
which owns both the wording and the verbosity settings that gate it. DiffEqBase.jl
implements this for `DEIntegrator`s. The default is a no-op, so a stack that does not
implement it still gets correct return codes, just no diagnostics.

Implementations must not affect control flow and their return value is ignored. A
`reason` configured at `SciMLLogging.ErrorLevel` throws instead of returning, which is
the intended behaviour of that level.
"""
@inline report_integrator_failure(integrator, ::Val) = nothing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who consumes this that isn't DiffEqBase?

Comment on lines +984 to 989

Diagnostics for detected failures are emitted through
[`report_integrator_failure`](@ref), which the solver stack implements; this
function only performs detection.
"""
function check_error(integrator::DEIntegrator)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who consumes this that isn't DiffEqBase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the answer is that its only DiffEqBase, but when I dropped check_error entirely from SciMLBase, there didn't seem to be a clean way to merge everything in one go without breaking one of DiffEqBase or SciMLBase (or a relevant dep), so the best solution I could think of was a more gradual approach, so we leave this small bit for now, and gradually migrate everything to make sure that we do this right.

Comment thread src/SciMLBase.jl Outdated
Comment on lines +2368 to +2369
# Integrator diagnostic hooks
@public report_integrator_failure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would this be public if it's being removed?

Comment thread src/SciMLBase.jl Resolved
@ChrisRackauckas
ChrisRackauckas merged commit a355173 into SciML:master Aug 18, 2026
44 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants