Improvements to scripting error handling.

This commits makes it so that scripts post pre-parsed syntax errors to the error handler.
More improvements to scripting error reporting.