Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #948 +/- ##
==========================================
+ Coverage 94.61% 95.94% +1.32%
==========================================
Files 69 65 -4
Lines 3973 3870 -103
==========================================
- Hits 3759 3713 -46
+ Misses 214 157 -57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Refactors MICM’s error handling away from per-module std::system_error boilerplate into a unified micm::MicmException carrying severity, category, and integer error codes, with corresponding test updates to validate the new exception type/codes across CPU and CUDA paths.
Changes:
- Introduces
micm::MicmException/MicmSeverityand updates code to throw it instead ofstd::system_error. - Removes several legacy
*_error.hppheaders that implementedstd::error_category/make_error_codefor modules. - Updates unit tests to expect
MicmExceptionand validate MICM error codes directly.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/util/test_sparse_matrix_standard_ordering_row.cpp | Updates sparse-matrix builder tests to expect MicmException and matrix error codes. |
| test/unit/util/test_sparse_matrix_standard_ordering_column.cpp | Same as above for column ordering. |
| test/unit/util/test_sparse_matrix_policy.hpp | Updates matrix policy tests to check MicmException::code_ against matrix error codes. |
| test/unit/system/test_species.cpp | Updates species property tests to catch MicmException and verify species error codes. |
| test/unit/solver/test_solver_builder.cpp | Updates solver builder test to expect MicmException. |
| test/unit/process/rate_constant/test_surface_rate_constant.cpp | Updates surface rate constant tests to catch MicmException and validate species error codes. |
| test/unit/constraint/test_equilibrium_constraint.cpp | Updates constraint tests to expect MicmException. |
| test/unit/constraint/test_constraint_set.cpp | Updates constraint-set tests to expect MicmException. |
| src/util/cuda_util.cu | Replaces internal-error helper with MicmException throws for CUDA/CUBLAS errors. |
| src/util/cuda_matrix.cu | Removes now-unused internal error include (cleanup after error refactor). |
| src/solver/rosenbrock.cu | Replaces INTERNAL_ERROR usage with MicmException for internal CUDA solver mismatches. |
| include/micm/util/vector_matrix.hpp | Replaces matrix std::system_error throws with MicmException. |
| include/micm/util/sparse_matrix_vector_ordering_compressed_sparse_row.hpp | Switches sparse row ordering errors to MicmException. |
| include/micm/util/sparse_matrix_vector_ordering_compressed_sparse_column.hpp | Switches sparse column ordering errors to MicmException. |
| include/micm/util/sparse_matrix_standard_ordering_compressed_sparse_row.hpp | Switches standard CSR ordering errors to MicmException. |
| include/micm/util/sparse_matrix_standard_ordering_compressed_sparse_column.hpp | Switches standard CSC ordering errors to MicmException and includes new exception header. |
| include/micm/util/sparse_matrix.hpp | Replaces sparse-matrix std::system_error throws with MicmException. |
| include/micm/util/micm_exception.hpp | Adds the new unified exception type and severity enum. |
| include/micm/util/matrix_error.hpp | Removes legacy matrix std::error_category error plumbing. |
| include/micm/util/matrix.hpp | Replaces dense-matrix std::system_error throws with MicmException. |
| include/micm/util/internal_error.hpp | Removes legacy internal error helper/macro. |
| include/micm/system/species.hpp | Replaces species std::system_error throws with MicmException and removes legacy category boilerplate. |
| include/micm/solver/state.inl | Replaces state std::system_error throws with MicmException and removes legacy category boilerplate. |
| include/micm/solver/state.hpp | Ensures state includes required headers for new exception usage. |
| include/micm/solver/solver_error.hpp | Removes legacy solver std::error_category error plumbing. |
| include/micm/solver/solver_builder.inl | Switches solver builder errors/warnings to MicmException with severity. |
| include/micm/solver/solver_builder.hpp | Removes legacy solver error header include. |
| include/micm/process/rate_constant/user_defined_rate_constant.hpp | Switches missing-argument error to MicmException. |
| include/micm/process/rate_constant/surface_rate_constant.hpp | Switches missing-property/missing-argument errors to MicmException. |
| include/micm/process/rate_constant/rate_constant.hpp | Removes legacy rate-constant std::error_category boilerplate and includes new exception header. |
| include/micm/process/process_set.hpp | Switches process validation errors to MicmException. |
| include/micm/process/process_error.hpp | Removes legacy process std::error_category error plumbing. |
| include/micm/process/phase_transfer_process_builder.hpp | Switches null coefficient error to MicmException. |
| include/micm/process/phase_transfer_process.hpp | Switches validation/copy errors to MicmException. |
| include/micm/process/chemical_reaction_builder.hpp | Switches missing rate constant error to MicmException. |
| include/micm/process/chemical_reaction.hpp | Switches validation/copy errors to MicmException. |
| include/micm/constraint/equilibrium_constraint.hpp | Switches constraint validation errors to MicmException. |
| include/micm/constraint/constraint_set.hpp | Switches unknown-species constraint error to MicmException. |
| include/micm/constraint/constraint_error.hpp | Removes legacy constraint std::error_category error plumbing. |
| include/micm/Util.hpp | Updates umbrella include to expose micm_exception.hpp and removes legacy error headers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
include/micm/util/sparse_matrix_standard_ordering_compressed_sparse_row.hpp
Show resolved
Hide resolved
include/micm/util/sparse_matrix_standard_ordering_compressed_sparse_row.hpp
Outdated
Show resolved
Hide resolved
- Change category_ member from string_view to const char* to avoid dangling reference risk when passing temporaries - Add direct include of micm_exception.hpp to sparse_matrix.hpp and sparse_matrix_standard_ordering_compressed_sparse_row.hpp - Fix matrix.hpp bug where constructed msg was dropped (passed "" instead) - Fill in all empty exception message strings across matrix, sparse matrix, constraint, rate constant, and state throw sites Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closes #861
Claude did a lot of the work. I am happy to close this PR if we don't find it useful