-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve loadscript #55
Comments
What do you mean by 'the URL is correct'? |
E.g., when the URL is misspelled and doesn't load, or when it loads gibberish that cannot be interpreted as javascript, it just says something like "Script error". Ideally it should highlight the loadscript line and print an error message "Could not load script http://badurl" |
I tried to use try...catch, but the following code fails to catch the error, which is thrown in CoffeeScript.load, and lets the error pass through:
|
How odd! What sort of error can't be caught by try/catch? On Wed, May 21, 2014 at 4:08 PM, Weihang Fan [email protected]:
|
I also tried to just throw an error in the try clause, which worked correctly, being caught. |
Oops, CoffeeScript.load does an ajax request. I'll patch in pencil-coffee-script. |
We're going to start using loadscript in material. For example, an exercise about search algorithms will begin with this:
await loadscript '//csp.pencilcode.net/lib/find.coffee', defer()
A couple things should be fixed:
(1) Let's shorten this line by shortening the name of the function to 'script' from 'loadscript'.
(2) When the URL is incorrect, the error message shown is incomprehensible. There should be a good error message, and it should highlight the line of code that contains the call to load the script.
The text was updated successfully, but these errors were encountered: