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

feat[ux]: move exception hint to the end of the message #4154

Merged
merged 10 commits into from
Sep 16, 2024

Conversation

cyberthirst
Copy link
Collaborator

@cyberthirst cyberthirst commented Jun 16, 2024

What I did

  • moved the (hint: ...) to be reported as the last item to improve the readability
  • the hint should be displayed after the actual problem has been described, ie, as the last item

example:

original:

vyper.exceptions.InvalidOperation: Cannot perform decimal division on uint256

  (hint: did you mean `10 // 4`?)

  contract "tests/custom/test.vy:3", function "f", line 3:17 
       2 def f(x: Bytes[32*5]):
  ---> 3     k: uint256 = 10 / 4
  ------------------------^

new order:

vyper.exceptions.InvalidOperation: Cannot perform decimal division on uint256

  contract "tests/custom/test.vy:3", function "f", line 3:17 
       2 def f(x: Bytes[32*5]):
  ---> 3     k: uint256 = 10 / 4
  ------------------------^

  (hint: did you mean `10 // 4`?)

edit: fix the example

How to verify it

Commit message

moved the `(hint: ...)` to be reported at the end of the exception to
improve the readability. the hint should be displayed after the actual
problem has been described, i.e. as the last item in the exception
message.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@cyberthirst
Copy link
Collaborator Author

Given how close the 0.4.0 release is, I think it might be wise to merge after the release.

@cyberthirst cyberthirst marked this pull request as draft June 16, 2024 08:05
vyper/exceptions.py Outdated Show resolved Hide resolved
@cyberthirst cyberthirst added this to the v0.4.1 milestone Jul 29, 2024
@cyberthirst cyberthirst marked this pull request as ready for review August 5, 2024 08:31
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 46.17%. Comparing base (f909d6e) to head (f076af0).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
vyper/exceptions.py 25.00% 6 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (f909d6e) and HEAD (f076af0). Click for more details.

HEAD has 139 uploads less than BASE
Flag BASE (f909d6e) HEAD (f076af0)
140 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4154       +/-   ##
===========================================
- Coverage   91.35%   46.17%   -45.18%     
===========================================
  Files         109      109               
  Lines       15635    15641        +6     
  Branches     3443     3443               
===========================================
- Hits        14283     7222     -7061     
- Misses        920     7866     +6946     
- Partials      432      553      +121     

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

@cyberthirst
Copy link
Collaborator Author

The current version changes the message property semantics by excluding the hint. Given how the property is used in the broader context, it should be valid.

@charles-cooper charles-cooper changed the title feat[ux]: move exception hint to the last position feat[ux]: move exception hint to the end of message Sep 16, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) September 16, 2024 13:29
@charles-cooper charles-cooper changed the title feat[ux]: move exception hint to the end of message feat[ux]: move exception hint to the end of the message Sep 16, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) September 16, 2024 13:29
@charles-cooper charles-cooper merged commit 03095ce into vyperlang:master Sep 16, 2024
158 checks passed
charles-cooper added a commit to charles-cooper/vyper that referenced this pull request Oct 5, 2024
moved the `(hint: ...)` to be reported at the end of the exception to
improve the readability. the hint should be displayed after the actual
problem has been described, i.e. as the last item in the exception
message.

---------

Co-authored-by: Charles Cooper <[email protected]>
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