-
Notifications
You must be signed in to change notification settings - Fork 49
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
style[next]: standardize error messages. #1386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only reviewed the changes in the coding conventions document and they look good to me (just have some style suggestions typo fixes).
As an additional comment (probably outside of the scope of this PR), I think we should look into refactor a bit our code to add more custom exceptions in the places where it makes sense and also to make sure we catch internal exceptions and wrapped them into informative DSLErrors in all places visible to users.
Co-authored-by: Enrique González Paredes <[email protected]>
Out of scope for this PR but not for the project. Expect another PR along those lines. |
@@ -1108,7 +1108,7 @@ def unpack( | |||
def test_tuple_unpacking_too_many_values(cartesian_case): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was previously shadowed by the succeeding one (now renamed), and turned out to fail. The changes to foast_passes.type_deduction
are to make this one pass.
if not any(isinstance(i, tuple) for i in indices) and len(indices) != num_elts: | ||
if not any(isinstance(i, tuple) for i in indices) and len(targets) != num_elts: | ||
raise errors.DSLError( | ||
node.location, f"Too many values to unpack (expected {len(indices)})." | ||
node.location, f"Too many values to unpack (expected {len(targets)})." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes make the test for the failure mode of too many values pass. Compare #1386 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good.
Description
Scope
The scope of this PR is purely the styling of existing error messages in
gt4py.next
.Out of Scope
Refactoring exception types, automatically composing recurring types of error messages etc is explicitly deferred to future PRs.
Requirements