Skip to content

Commit 3d6960e

Browse files
committed
Throw exception if undefined passed to putValue
- Makes it easier to figure out what happened
1 parent 88b8f47 commit 3d6960e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pynetworktables2js/js/networktables.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,15 @@ var NetworkTables = new function () {
264264
this.putValue = function(key, value) {
265265
if (!socketOpen)
266266
return false;
267-
267+
268+
if (value === undefined)
269+
throw new Error(key + ": 'undefined' passed to putValue");
270+
268271
socket.send(JSON.stringify({'k': key, 'v': value}));
269272
return true;
270273
};
271274

272-
// backwards compatibility; depreciated
275+
// backwards compatibility; deprecated
273276
this.setValue = this.putValue;
274277

275278
//

0 commit comments

Comments
 (0)