code-dot-org/blockly — pull request #575 by Bjvanminnen (2014-05-13 19:37:34+00:00)
Title: Request for Feedback: stop maze from throw exceptions for unexceptional cases

I'm not going to check this in without first writing some unit tests, but wanted to first see if others thought this was reasonable.

I'll also be sure to remove the throw true/false lines rather than just commenting them out.

Historically when executing user code in maze we would throw by design in the following cases:
(1) Throw true as soon as they reach the goal (for farmer, reaching the goal means getting all the dirt to 0).
(2) Throw false when you walk into a wall/obstacle
(3) Throw Infinity if we detect an infinite loop. The log will still contain all the commands up to that point.
(4) If we execute everything and didn't throw, we failed to reach the goal.

This change reduces these cases to just #3. Instead, we'll post-process BlocklyApps.log to determine ResultType/stepSpeed. This is still a little bit ugly, and may have more opportunity for cleanup, but I think it's better than what we were doing.

There are a couple reasons I'd like to have this change that I can get into, though I can probably accomplish those things in different ways if people don't think this is worthwhile.

Do you think this change makes things better?