Skip to content

Add structured validation error#745

Merged
jrasko merged 3 commits into
mainfrom
structured-errors
Feb 25, 2026
Merged

Add structured validation error#745
jrasko merged 3 commits into
mainfrom
structured-errors

Conversation

@jrasko

@jrasko jrasko commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Description

Use structured errors to identify the faulty inputs and allow the frontend to make them visible to the user

Checklist

  • Documentation updated (docstrings, READMEs, user guides, inline comments, doc folder updates etc.)
  • Changes noted in release notes (if any)
  • Consent to release this PR's code under the GNU Affero General Public License v3.0

@jrasko
jrasko requested a review from a team February 24, 2026 14:59
Signed-off-by: Jannik <raskob@fh-aachen.de>
Signed-off-by: Jannik <raskob@fh-aachen.de>
@jrasko
jrasko marked this pull request as ready for review February 24, 2026 15:08
Comment thread docs/source/release_notes.rst
@codecov

codecov Bot commented Feb 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.60976% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.85%. Comparing base (c4a9d4b) to head (79c7902).
⚠️ Report is 82 commits behind head on main.

Files with missing lines Patch % Lines
assume/units/storage.py 72.72% 6 Missing ⚠️
assume/units/powerplant.py 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #745      +/-   ##
==========================================
+ Coverage   81.83%   81.85%   +0.01%     
==========================================
  Files          55       55              
  Lines        8280     8288       +8     
==========================================
+ Hits         6776     6784       +8     
  Misses       1504     1504              
Flag Coverage Δ
pytest 81.85% <75.60%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@maurerle maurerle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The rational behind this change is to support #705 and the assume-gui part.
This helps to have more information about which component causes a validation error in tools using assume (like the assume-gui).

pass


class ValidationError(ValueError):

@maurerle maurerle Feb 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would like to have every custom Exception in this File to inherit from AssumeException as well..?
You should inherit from both to not break existing catches of ValueError, but also align with the AssumeException idea.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I still not get the idea of the Assume exception. What is its purpose (when should it be thrown)? To which use-case does this exception add value? We might use this opportunity to clarify and document this.

Comment thread assume/units/powerplant.py
Signed-off-by: Jannik <raskob@fh-aachen.de>
@jrasko
jrasko merged commit c482be8 into main Feb 25, 2026
8 of 9 checks passed
@jrasko
jrasko deleted the structured-errors branch February 25, 2026 14:41
pdockery pushed a commit to pdockery/assume that referenced this pull request Mar 13, 2026
## Description
Use structured errors to identify the faulty inputs and allow the
frontend to make them visible to the user

## Checklist
- [x] Documentation updated (docstrings, READMEs, user guides, inline
comments, `doc` folder updates etc.)
- [x] Changes noted in release notes (if any)
- [x] Consent to release this PR's code under the GNU Affero General
Public License v3.0
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