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

[BUG] Unclear message "unsupported operand type(s) for //: 'int' and 'str'" #3465

Closed
qnojansen opened this issue Oct 19, 2022 · 4 comments · Fixed by #5226
Closed

[BUG] Unclear message "unsupported operand type(s) for //: 'int' and 'str'" #3465

qnojansen opened this issue Oct 19, 2022 · 4 comments · Fixed by #5226
Assignees
Labels
language Issues related to the Hedy language

Comments

@qnojansen
Copy link

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.

@Felienne
Copy link
Member

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?

@jpelay jpelay self-assigned this Oct 28, 2022
@jpelay
Copy link
Member

jpelay commented Oct 28, 2022

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!

@Felienne
Copy link
Member

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!

@Felienne Felienne added the language Issues related to the Hedy language label Sep 23, 2023
@Felienne
Copy link
Member

One more for @boryanagoncharenko?

@boryanagoncharenko boryanagoncharenko self-assigned this Feb 24, 2024
@mergify mergify bot closed this as completed in #5226 Mar 12, 2024
mergify bot pushed a commit that referenced this issue Mar 12, 2024
… (#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
```
boryanagoncharenko added a commit that referenced this issue Mar 13, 2024
… (#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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Issues related to the Hedy language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants