r9642 - helma-ng/trunk/apps/jack

[email protected] Tue, 21 Apr 2009 18:26:49 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090421162649.80ED13D0D6@mia>
Author: hannes
Date: 2009-04-21 18:26:49 +0200 (Tue, 21 Apr 2009)
New Revision: 9642

Modified:
   helma-ng/trunk/apps/jack/main.js
Log:
Print message and exit if jack libs can't be loaded.

Details at http://dev.helma.org/trac/helma/changeset/9642

Modified: helma-ng/trunk/apps/jack/main.js
===================================================================
--- helma-ng/trunk/apps/jack/main.js	2009-04-21 15:25:01 UTC (rev 9641)
+++ helma-ng/trunk/apps/jack/main.js	2009-04-21 16:26:49 UTC (rev 9642)
@@ -1,10 +1,22 @@
-var http = require('helma/httpserver');
-http.start({
-    port: 8080,
-    moduleName: 'jack/narwhal',
-    functionName: 'Narwhal'
-});
+try {
 
-// Alternatively, you can pass the jack app to start() as second argument.
-// this bypasses module loading in the servlet, so changes in the Jack app won't be picked up.
-// http.start({ port: 8080 }, require('jack/narwhal').Narwhal);
+    // fail fast if no jack libs on the module path
+    require('jack/narwhal');
+
+    var http = require('helma/httpserver');
+    http.start({
+        port: 8080,
+        moduleName: 'jack/narwhal',
+        functionName: 'Narwhal'
+    });
+
+    // Alternatively, you can pass the jack app to start() as second argument.
+    // this bypasses module loading in the servlet, so changes in the Jack app won't be picked up.
+    // http.start({ port: 8080 }, require('jack/narwhal').Narwhal);
+
+} catch (error) {
+    print();
+    print("Can't start Jack demo. Make sure you have Jack installed and configured as described in README.txt.");
+    print();
+    print(error);
+}