Browse Source

Be more graceful when there are no active sessions

Caleb James DeLisle 9 years ago
parent
commit
fa6316a8df
2 changed files with 7 additions and 2 deletions
  1. 2 1
      contrib/nodejs/cjdnsadmin/cjdnsadmin.js
  2. 5 1
      tools/sessionStats

+ 2 - 1
contrib/nodejs/cjdnsadmin/cjdnsadmin.js

@@ -116,7 +116,8 @@ var makeFunction = function (sock, addr, port, pass, funcName, func) {
             var arg = arguments[i];
             if (!args[i].required && (arg === null || arg === undefined)) { continue; }
             if (!compatibleType(args[i].type, arg)) {
-                throw new Error("argument [" + i + "] [" + args[i].type + " " + args[i].name + "]" +
+                throw new Error("argument [" + i + "] ([" + arguments[i] + "]) [" +
+                                args[i].type + " " + args[i].name + "]" +
                                 " is of type [" + typeof(arg) + "] which is not compatible with " +
                                 "required type " + args[i].type);
             }

+ 5 - 1
tools/sessionStats

@@ -57,7 +57,11 @@ nThen(function (waitFor) {
             if (i < handles.length) { next(i); }
         }));
     };
-    next(0);
+    if (handles.length) {
+        next(0);
+    } else {
+        console.log("No active sessions");
+    }
 
 }).nThen(function (waitFor) {
     cjdns.disconnect();