Skip to content

Commit

Permalink
Throw exception if undefined passed to putValue
Browse files Browse the repository at this point in the history
- Makes it easier to figure out what happened
  • Loading branch information
virtuald committed Apr 1, 2016
1 parent 88b8f47 commit 3d6960e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pynetworktables2js/js/networktables.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,15 @@ var NetworkTables = new function () {
this.putValue = function(key, value) {
if (!socketOpen)
return false;


if (value === undefined)
throw new Error(key + ": 'undefined' passed to putValue");

socket.send(JSON.stringify({'k': key, 'v': value}));
return true;
};

// backwards compatibility; depreciated
// backwards compatibility; deprecated
this.setValue = this.putValue;

//
Expand Down

0 comments on commit 3d6960e

Please sign in to comment.