hedy
hedy copied to clipboard
[BUG] Empty character in error message
Describe the bug Sometimes the error messages do not contain a character, for example:
Paste the Hedy code & level level 2:
keuzes is steen, schaar, papier
print keuzes at random
ask is de papier goed?
As far as I can see this only happens when the character is a newline, which is addressed by #1210
But maybe we should replace the final return s in translate_characters() into a world like "something" so we can return something like:
"You typed something that is not allowed"? Let's see if there are cases besides newline, leaving this open for a bit.
As far as I can see this only happens when the character is a newline, which is addressed by #1210
But maybe we should replace the final return s in translate_characters() into a world like "something" so we can return something like:
"You typed something that is not allowed"? Let's see if there are cases besides newline, leaving this open for a bit.
I think this is a great idea! Sometimes when you type something wrong that isn't detected by the parser it says, for example, "You typed e but that's not allowed", it has happened to me while testing the if.. else statements, and it isn't really helpful imo.
The error handling has been changed and I now get a message that says the code is not correct for the level I'm on:
Ah that is a lot better for this specific use case. Maybe we (meaning I) should investigate if we still have other cases in the logs were an empty character is shown, or as @jpelay points out, a letter because that is also not great. I think in general we want to prevent ParseExceptions as much as possible since they never lead to great error messages.
This error message has changed and I have not been able to find other cases of empty characters in the dataset.