Skip to content

Conversation

@WardBrian
Copy link
Member

Summary

The errors we throw based on CVODES flags were sometimes std::runtime_errors, which we'd like to be able to use for other things (e.g. exit() in the language and other things which aren't recoverable).

This changes all of them to domain_error, which is what we use for other issues that could be resolved by changing the parameters and trying again.

I believe this should close #1039, which was already partially addressed by #2620

Tests

Side Effects

Release notes

Functions which are wrappers around CVODES and IDAS routines from Sundials now throw domain_error, rather than a mix of domain_error and runtime_error

Checklist

  • Copyright holder: Simons Foundation

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@WardBrian WardBrian requested a review from syclik January 25, 2024 20:38
Copy link
Member

@syclik syclik left a comment

Choose a reason for hiding this comment

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

LGTM!

@syclik
Copy link
Member

syclik commented Jan 27, 2024

@WardBrian, thanks! And yes, this should resolve #1039. This is definitely an improvement the current behavior.

(Maybe someone with deep CVODES expertise could separate out the different error conditions, but that could come later if it matters.)

@WardBrian WardBrian merged commit 4b40ec5 into develop Jan 29, 2024
@WardBrian WardBrian deleted the errors/cvodes-domain-error branch January 29, 2024 19:38
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.

Add better error handling for CVODES

3 participants