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

Improves error messages for ClassLists #80

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

DrPaulSharp
Copy link
Collaborator

@DrPaulSharp DrPaulSharp commented Sep 27, 2024

This PR refactors the ClassList._check_classes and ClassList._check_unique_name_fields routines to provide better error messages, specifically including the indices of the bad input in the input lists. This may help with mitigating the coercion issue identified in #79 alongside giving better information for bad input to routines that mutate ClassLists.

I'm open to input about the format of the error messages.

Copy link
Collaborator

@alexhroom alexhroom 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 (as good as the Pydantic errors) but i think we could maybe push them to be better than the Pydantic errors, to make users' lives a lot simpler if they've got large lists. I also think that _validate_name_field could be updated to have a better error that e.g. says what indices the name is already defined at

RATapi/classlist.py Show resolved Hide resolved
RATapi/classlist.py Outdated Show resolved Hide resolved
@DrPaulSharp DrPaulSharp merged commit dfef174 into RascalSoftware:main Oct 2, 2024
7 checks passed
@DrPaulSharp DrPaulSharp deleted the errors branch October 2, 2024 08:57
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