hedy icon indicating copy to clipboard operation
hedy copied to clipboard

[BUG] Empty character in error message

Open Felienne opened this issue 3 years ago • 3 comments

Describe the bug Sometimes the error messages do not contain a character, for example:

image

Paste the Hedy code & level level 2:

keuzes is steen, schaar, papier
print keuzes at random
ask is de papier goed?

Felienne avatar Nov 08 '21 13:11 Felienne

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.

Felienne avatar Nov 08 '21 14:11 Felienne

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.

jpelay avatar Nov 08 '21 15:11 jpelay

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:

image

arjank avatar Oct 16 '22 17:10 arjank

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.

Felienne avatar Oct 27 '22 07:10 Felienne

This error message has changed and I have not been able to find other cases of empty characters in the dataset.

Felienne avatar Dec 03 '22 12:12 Felienne