Khan / live-editor

A browser-based live coding environment.
Other
761 stars 184 forks source link

for() Infinite Loop, unhelpful error. #522

Closed codeHusky closed 8 years ago

codeHusky commented 8 years ago

Screenshot Program In Question Basically, I ran against the wall a whole bunch and what I'm assuming is the loop protector fired. It leaves behind a really unhelpful error.

bytorbrynden commented 8 years ago

Related to https://github.com/Khan/live-editor/issues/521.

codeHusky commented 8 years ago

Partially #518 as well, but more specifically the message issue.

kevinbarabash commented 8 years ago

I think this is a duplicate of https://github.com/Khan/live-editor/issues/521, but since one has a nice screenshot I'll close the other as a duplicate of this.

bytorbrynden commented 8 years ago

I decided to (try and) spread some holiday cheer, by creating a really inaccurate "snow simulation" using the Khan Academy PJS environment (don't worry, I'm making one for terminal as well).

The idea, is that snow (ellipses) fall down the canvas, and then stop once it hits the ground (the bottom of the canvas, minus an offset).

Here's the program: https://www.khanacademy.org/computer-programming/simple-snow/6509434456637440

After the program runs for a little while, I get the error that @MikaalSky reported...: snow1

I'm sure I could resolve this problem by removing the "snowflakes" after they hit the bottom of the screen, but where's the fun in that?

Merry Christmas,

Gigabyte Giant

benburrill commented 8 years ago

The specific line of code that is at fault here is probably https://github.com/Khan/live-editor/blob/d75ef52dc624ac62e64a169437d8169962927786/js/output/pjs/pjs-output.js#L492
The callback assumes that the error will have an html property, but it actually has a infiniteLoopNodeType (or whatever it's called) property.

kevinbarabash commented 8 years ago

@Potato42 good detective work. Would you be able to put together a pull request with the correct property?

benburrill commented 8 years ago

I've had bad luck in the past with the building process for live-editor PRs on windows. I might consider trying again, but if I understand the problem correctly, it's a really simple fix for someone who isn't on windows and is more competent at git and build tools than I am. Basically, just take the message from here, and use LoopProtector.nodeMessages[error.infiniteLoopNodeType] for the type.

benjaminjkraft commented 8 years ago

I'm going to take a look at this while I'm looking at another related thing; not sure if I will get a chance to fix it, but if not I'll unassign myself so others can.

benjaminjkraft commented 8 years ago

I believe this was also fixed in d16b858 -- error-buddy now shows the location and a proper error message -- but I'm not entirely sure if I had a consistent repro of it in the first place. Please feel free to reopen or make a new issue if this isn't actually fixed for you, and thanks for all the reports!