Permalink
Browse files

error handling for invalid client id

  • Loading branch information...
1 parent 1cebd0d commit f037a797be1dbb9905e373ed02c0475609a40234 @joeferner joeferner committed Feb 23, 2012
Showing with 6 additions and 2 deletions.
  1. +1 −1 bin/remote_js.js
  2. +5 −1 server/remote_execution.js
View
@@ -203,7 +203,7 @@
}
shell.prompt();
});
-
+
shell.setPrompt('> ');
printInstructions(args);
@@ -81,7 +81,11 @@ RemoteExecution.prototype.sendCmd = function (clientId, cmd) {
RemoteExecution.prototype.send = function (clientId, data) {
var client = this.clients[clientId];
- client.connection.emit("command", data);
+ if (client) {
+ client.connection.emit("command", data);
+ } else {
+ throw new Error("Invalid client id " + clientId);
+ }
};
exports.RemoteExecution = RemoteExecution;

0 comments on commit f037a79

Please sign in to comment.