Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exceptions for UnitAlgebra errors #1043

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

berquist
Copy link
Member

Closes #1037

Here is a proposal for adding exceptions to the core public API. Doxygen is missing until we decide on the form of exceptions.

Thoughts:

  • Since these exceptions are specific for UnitAlgebra, I've added them inside the UnitAlgebra class rather than just the header.
  • There is a base UnitAlgebraException in case a consumer (elements, some other code) wants to catch a more generic exception type rather than one of the more specific types.
  • The base UnitAlgebraException inherits from logic_error rather than exception since these are fundamentally not runtime errors.
  • As a development guideline, it seems like reasons/messages given by C++ exceptions should be actionable directly Python side: the message passed to PyErr_SetString should always be exception_instance.what().

For the tests, I used assert statements rather than the existing correct_throw idiom.

@github-actions github-actions bot added AT: WIP Mark PR as a Work in Progress (No Autotesting Performed) AT: CLANG-FORMAT PASS and removed AT: WIP Mark PR as a Work in Progress (No Autotesting Performed) labels Jan 30, 2024
Copy link

CLANG-FORMAT TEST - PASSED

Copy link

CMAKE-FORMAT TEST - PASSED

Copy link
Contributor

@feldergast feldergast left a comment

Choose a reason for hiding this comment

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

Looks good. This will be a nice addition.

@sst-autotester
Copy link
Contributor

Status Flag 'Pre-Test Inspection' - Auto Inspected - Inspection is Not Necessary for this Pull Request.

@sst-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects:

Pull Request Auto Testing STARTING (click to expand)

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements

  • Build Num: 1333
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements_MR-2

  • Build Num: 1314
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements_MT-2

  • Build Num: 1316
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-macro_withsstcore

  • Build Num: 496
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-core

  • Build Num: 413
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-core_Make-Dist

  • Build Num: 371
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_Clang-Format_sst-core

  • Build Num: 325
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_OSX-13.2-XC14-ARM_OMPI-4.1.4_PY3.10_sst-elements

  • Build Num: 673
  • Status: STARTED

Build Information

Test Name: SST__AutotestGen2_NewFW_OSX-13.2-XC14-ARM_OMPI-4.1.4_PY3.10_sst-macro_withsstcore

  • Build Num: 159
  • Status: STARTED

Using Repos:

Repo: CORE (berquist/sst-core)
  • Branch: 1037-unitalgebra-exceptions
  • SHA: 575e288
  • Mode: TEST_REPO
Repo: SQE (sstsimulator/sst-sqe)
  • Branch: devel
  • SHA: 69a32cbc43ea21c63d3a62f25a71697c0d39f686
  • Mode: SUPPORT_REPO
Repo: ELEMENTS (sstsimulator/sst-elements)
  • Branch: devel
  • SHA: a3e833500999051d60944f6151e37dbf766fc918
  • Mode: SUPPORT_REPO
Repo: MACRO (sstsimulator/sst-macro)
  • Branch: devel
  • SHA: 0443cf578fcfd2fe8fe9ac3b039c3e16ba1f5892
  • Mode: SUPPORT_REPO

Pull Request Author: berquist

@sst-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED

Pull Request Auto Testing has PASSED (click to expand)

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements

  • Build Num: 1333
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements_MR-2

  • Build Num: 1314
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-elements_MT-2

  • Build Num: 1316
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-macro_withsstcore

  • Build Num: 496
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-core

  • Build Num: 413
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_OMPI-4.1.4_PY3.6_sst-core_Make-Dist

  • Build Num: 371
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_sst-test_Clang-Format_sst-core

  • Build Num: 325
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_OSX-13.2-XC14-ARM_OMPI-4.1.4_PY3.10_sst-elements

  • Build Num: 673
  • Status: PASSED

Build Information

Test Name: SST__AutotestGen2_NewFW_OSX-13.2-XC14-ARM_OMPI-4.1.4_PY3.10_sst-macro_withsstcore

  • Build Num: 159
  • Status: PASSED

@sst-autotester
Copy link
Contributor

Status Flag 'Pre-Merge Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED AND APPROVED by [ feldergast ]!

@sst-autotester
Copy link
Contributor

Status Flag 'Pull Request AutoTester' - Pull Request MUST BE MERGED MANUALLY BY Project Team - Forked Repos cannot Automerge

@feldergast feldergast merged commit 3889d47 into sstsimulator:devel Jan 30, 2024
5 checks passed
@berquist berquist deleted the 1037-unitalgebra-exceptions branch January 30, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants