-
Notifications
You must be signed in to change notification settings - Fork 289
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
[BUG] Unclear message "unsupported operand type(s) for //: 'int' and 'str'" #3465
Comments
Thanks for noticing @qnojansen!! This one is quite similar to #3463 in the sense that it is also a Python message leaking out. @jpelay maybe this one could also be for you? |
Yes of course! When I create the error message I'll send it to you so you can provide me with the correct Dutch translation! |
For sure! I can just push them on the PR whenever you are ready! |
One more for @boryanagoncharenko? |
… (#5226) Fixes #3465 Add custom error message when calculations are passed incompatible types. **How to test** - All automated tests should pass - Run Hedy locally and navigate to specified level. Run the following code and supply a string instead of a number. Ensure that there is a nice error displayed and no python error leaks: Level 6 ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 / hoeken print hoek ``` Level 12 ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 / hoeken print hoek ``` Level 12. Note that addition should show a different error since concatenation works from level 12. ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 + hoeken print hoek ```
… (#5226) Fixes #3465 Add custom error message when calculations are passed incompatible types. **How to test** - All automated tests should pass - Run Hedy locally and navigate to specified level. Run the following code and supply a string instead of a number. Ensure that there is a nice error displayed and no python error leaks: Level 6 ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 / hoeken print hoek ``` Level 12 ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 / hoeken print hoek ``` Level 12. Note that addition should show a different error since concatenation works from level 12. ``` hoeken = ask 'Hoeveel hoeken krijgt dit figuur?' hoek = 360 + hoeken print hoek ```
Describe the bug
When you use ask to ask the user to type a number but the user enters a text, you get the error message "unsupported operand type(s) for //: 'int' and 'str'". This is not clear to the students.
Paste the Hedy code & level
Level 15
hoeken = ask 'Hoeveel hoeken krijgt dit figuur?'
hoek = 360 / hoeken
repeat hoeken times
repeat hoeken times
forward hoek
turn hoek
turn hoek
forward hoek
Expected behavior
The error message should be more clear (and in Dutch) so students know what went wrong here.
The text was updated successfully, but these errors were encountered: