Skip to content

feat: add improved exception handling - #250

Draft
rpreen wants to merge 2 commits into
masterfrom
exception_handling
Draft

rpreen wants to merge 2 commits into
masterfrom
exception_handling

Conversation

@rpreen

@rpreen rpreen commented Oct 26, 2026

Copy link
Copy Markdown
Member

WIP: resolves #200

The idea is to replace all current C error handling calls to exit() with a call to xcsf_set_error() which sets an error status (int) and a err_msg (char[256]) in the XCSF data structure. The errors should then be allowed to bubble up to either main.c which can call exit() or pybind_wrapper.cpp which can throw an exception that is then used by the Python interpreter.

Unfortunately this will touch a lot of files.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.26%. Comparing base (47587ed) to head (f24bff1).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
xcsf/condition.c 6.66% 14 Missing ⚠️
xcsf/xcsf.c 47.82% 12 Missing ⚠️
xcsf/rule_neural.c 0.00% 9 Missing ⚠️
xcsf/prediction.c 11.11% 8 Missing ⚠️
xcsf/clset.c 53.33% 7 Missing ⚠️
xcsf/param.c 95.13% 7 Missing ⚠️
xcsf/rule_dgp.c 0.00% 7 Missing ⚠️
xcsf/action.h 14.28% 6 Missing ⚠️
xcsf/cond_ellipsoid.c 14.28% 6 Missing ⚠️
xcsf/condition.h 37.50% 5 Missing ⚠️
... and 16 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #250      +/-   ##
==========================================
+ Coverage   70.53%   72.26%   +1.73%     
==========================================
  Files          61       61              
  Lines        8566     8517      -49     
  Branches      952      963      +11     
==========================================
+ Hits         6042     6155     +113     
+ Misses       2524     2362     -162     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rpreen
rpreen force-pushed the exception_handling branch 3 times, most recently from c3e1c6b to 965540b Compare November 1, 2026 18:09
Comment thread xcsf/xcsf.c
xcsf->status = code;
va_list args;
va_start(args, fmt);
vsnprintf(xcsf->err_msg, sizeof(xcsf->err_msg), fmt, args);
@rpreen
rpreen force-pushed the exception_handling branch 3 times, most recently from cfc1d5a to 72e913a Compare November 1, 2026 21:42
@rpreen
rpreen force-pushed the exception_handling branch from 72e913a to f24bff1 Compare November 1, 2026 23:31
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

This branch has not been deployed

No deployments
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.

Error handling {c,sh}ould be improved

2 participants