diff --git a/README.md b/README.md index d80e67f6..ecd22bd7 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,24 @@ older Rhino. The build script for JSDoc 3 requires Apache ant. It is know to work with version 1.8.2 of ant. -See ---- +Debugging +--------- + +Rhino is not always very friendly when it comes to reporting errors in +JavaScript. Luckily it comes with a full-on debugger included that can be much +more useful than a simple stack trace. To invoke JSDoc with the debugger try the +following command: + + $ java -classpath build-files/java/classes/js.jar \ + org.mozilla.javascript.tools.debugger.Main.main main.js `pwd` \ + your/script.js + +This will open a debugging window. Choose "Break on Exceptions" from the "Debug" +menu, then press the "Run" button. If there is an error, you should see exactly +where it is in the source code. + +See Also +-------- Project Documentation: (under development) JSDoc User's Group: diff --git a/main.js b/main.js index 0b2c4336..17d5113c 100644 --- a/main.js +++ b/main.js @@ -4,6 +4,7 @@ * @license See LICENSE.md file included in this distribution. */ +// try: $ java -classpath build-files/java/classes/js.jar org.mozilla.javascript.tools.shell.Main main.js `pwd` script/to/parse.js //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// @@ -11,7 +12,7 @@ @type string @global */ -const BASEDIR = arguments[0].replace(/([\/\\])main\.js$/, '$1'); // jsdoc.jar sets argument[0] to the abspath to main.js +const BASEDIR = arguments[0].replace(/([\/\\])main\.js$/, '$1') + '/'; // jsdoc.jar sets argument[0] to the abspath to main.js /** Include a JavaScript module, defined in the CommonJS way. @param {string} id The identifier of the module you require. @@ -112,6 +113,11 @@ app = { } try { main(); } +catch(e) { + if (e.rhinoException != null) { + e.rhinoException.printStackTrace(); + } +} finally { env.run.finish = new Date(); } /** Print string/s out to the console. diff --git a/package.json b/package.json index 4ff3d608..cfe04258 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jsdoc", "version": "3.0.0beta1", - "revision": "2011-04-10-2223", + "revision": "2011-04-12-2149", "description": "An automatic documentation generator for javascript.", "keywords": [ "documentation", "javascript" ], "licenses": [