Skip to content

common: reclassify exception types per AGENTS.md convention - #4492

Merged
jhale merged 1 commit into
mainfrom
jhale/common-exception-reclassify
Sep 14, 2026
Merged

jhale merged 1 commit into
mainfrom
jhale/common-exception-reclassify

Conversation

@jhale

@jhale jhale commented Sep 13, 2026

Copy link
Copy Markdown
Member

Summary

  • common throws that were std::runtime_error for bad arguments or missing lookup keys are reclassified per the AGENTS.md convention: std::invalid_argument for argument-precondition failures (sort_unique, distribute_data, math::det/inv/pinv, Table::reduce, IndexMap::create_submap), std::out_of_range for lookup-key failures (TimeLogger::timing, Table::get).
  • Timer::flush (object-state error) and petsc.cpp (external library failure, asserted as runtime_error by existing tests) are left unchanged.
  • No exception message text was changed.

Test plan

  • clang-format --dry-run --Werror clean on touched files
  • C++ library and Python interface build cleanly in Developer mode (-Werror)
  • fx-test dolfinx --cpp / Python test suite not yet run

AI assistance: I used Claude to draft this PR. I reviewed, edited, tested, and take responsibility for the final contribution.

@jhale
jhale changed the base branch from main to jhale/remove-function-space-check September 13, 2026 10:16
@jhale
jhale added this pull request to stack #4494 September 13, 2026 10:16
@jhale

jhale commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

Will rebase 😮

@jhale
jhale removed this pull request from stack #4494 September 13, 2026 12:37
@jhale
jhale changed the base branch from jhale/remove-function-space-check to main September 13, 2026 12:37
@jhale
jhale changed the base branch from main to jhale/remove-function-space-check September 13, 2026 12:38
@jhale
jhale added this pull request to stack #4498 September 13, 2026 12:38
@jhale
jhale removed this pull request from stack #4498 September 13, 2026 12:38
@jhale
jhale changed the base branch from jhale/remove-function-space-check to main September 13, 2026 12:38
@jhale
jhale added this pull request to stack #4499 September 13, 2026 12:38
Several `common` throws used `runtime_error` for what are really bad
arguments or missing lookup keys. Switch to `invalid_argument` for
argument-precondition failures (sort_unique, distribute_data, det/inv/pinv,
Table::reduce, IndexMap::create_submap) and `out_of_range` for lookup-key
failures (TimeLogger::timing, Table::get). Leaves Timer::flush (object
state) and petsc.cpp (external library failure) as runtime_error. No
message text changed.

AI assistance: I used Claude to draft this PR. I reviewed, edited, tested,
and take responsibility for the final contribution.
@jhale
jhale force-pushed the jhale/common-exception-reclassify branch from baee656 to f97670b Compare September 14, 2026 13:10
@jhale
jhale added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 49a79d9 Sep 14, 2026
22 checks passed
@jhale
jhale deleted the jhale/common-exception-reclassify branch September 14, 2026 14:54
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