Bladeren bron

Be more graceful when there are no active sessions

Caleb James DeLisle 9 jaren geleden
bovenliggende
commit
fa6316a8df
2 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen
  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();