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

[LANGUAGE] improve clear errors #4826

Merged
merged 14 commits into from
Dec 4, 2023
Merged

[LANGUAGE] improve clear errors #4826

merged 14 commits into from
Dec 4, 2023

Conversation

Felienne
Copy link
Member

@Felienne Felienne commented Nov 29, 2023

Some progress towards #4133.

This PR:

  • Stops giving a front-end message if you use a clear
  • Adds a small sleep to a clear so a program like
print 'Welcome two'
clear
print 'Welcome three'

more clearly shows what is happening.

If doesn't do #4133 fully because a lonely clear also gives no error message anymore (hence don't close the issue)

@ghost
Copy link

ghost commented Nov 29, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@@ -562,11 +562,15 @@ def parse():

if transpile_result.has_turtle:
response['has_turtle'] = True

if transpile_result.has_clear:
response['has_clear'] = True
except Exception:
pass

with querylog.log_time('detect_sleep'):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rix0rrr I don't think I understand what is happening here, and why, do you?

Firstly, why the exception? an "in" can't really fail, can it?

Secondly what does the logging do here exactly? Why do we need to log the time that this sleep checking occurs (if I understand correctly)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the except is there for safety. This used to be a function call.

The log_time is there to measure how long it takes to do this, in case we need to investigate slowness. With the new code shape, probably not necessary anymore either.

@Felienne Felienne marked this pull request as ready for review December 4, 2023 02:10
@Felienne
Copy link
Member Author

Felienne commented Dec 4, 2023

Added a little pause to clear! I have not added a new exception for lonely clear, but I propose to do that separately because it will be large with new error messages.

@Felienne Felienne requested a review from jpelay December 4, 2023 02:13
Copy link
Member

@jpelay jpelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

Copy link
Contributor

mergify bot commented Dec 4, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Dec 4, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Dec 4, 2023

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 26dc104 into main Dec 4, 2023
11 checks passed
@mergify mergify bot deleted the clear-errors branch December 4, 2023 17:04
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.

3 participants