launching server finds js errors - cannot compile .js file

9 views
Skip to first unread message

Aner Ben-Artzi

unread,
Jun 27, 2013, 12:29:42 PM6/27/13
to sil...@googlegroups.com
~/src/server1$ httpd-silk.js bootstrap.js
 *** Could not compile bootstrap.js
Could not compile js/hello.js
SyntaxError: Unexpected token -


How do I get the line number for the error?

Is there a way to do a sanity-check compile of the js without attempting to launch the server?

Thank,
Aner

Michael Schwartz

unread,
Jun 27, 2013, 12:49:55 PM6/27/13
to sil...@googlegroups.com
Unfortunately, v8 doesn't give nice error handling for compilation.  It's the same in the browser where we see messages like:
SyntaxError: Unexpected token *
In the console in Chrome when your HTML has a <SCRIPT> that has a syntax error somewhere in it.

If you run:

silkjs script.js

It will load script.js, run it, then exit.  So you could detect errors that way.

You can also try/catch around require() and include() .

You can also run your code through jslint or jshint.



--
You received this message because you are subscribed to the Google Groups "SilkJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silkjs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages