From faecf103bf0486ac0f7fe93b6906a19fdf677bee Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Wed, 29 Apr 2015 14:39:28 -0400 Subject: [PATCH 1/2] Upgrade Resin SDK to v1.3.4 This version addresses the device validation issue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 741eed35..16bd67ca 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "president": "^1.0.0", "progress-stream": "^0.5.0", "resin-cli-visuals": "^0.1.0", - "resin-sdk": "^1.3.3", + "resin-sdk": "^1.3.4", "resin-settings-client": "^1.0.0", "resin-vcs": "^1.2.0", "tmp": "^0.0.25", From fab85b381a8f7b70fb6e1e02e676ed3c0973e551 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Wed, 29 Apr 2015 14:39:46 -0400 Subject: [PATCH 2/2] Throw a nice error if note contents are missing --- build/actions/notes.js | 7 ++++++- lib/actions/notes.coffee | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build/actions/notes.js b/build/actions/notes.js index 2de622cb..224a9cee 100644 --- a/build/actions/notes.js +++ b/build/actions/notes.js @@ -1,5 +1,7 @@ (function() { - var async, resin; + var _, async, resin; + + _ = require('lodash'); async = require('async'); @@ -20,6 +22,9 @@ ], permission: 'user', action: function(params, options, done) { + if (_.isEmpty(params.note)) { + return done(new Error('Missing note content')); + } return resin.models.device.note(options.device, params.note, done); } }; diff --git a/lib/actions/notes.coffee b/lib/actions/notes.coffee index 39b5ab15..28317323 100644 --- a/lib/actions/notes.coffee +++ b/lib/actions/notes.coffee @@ -1,3 +1,4 @@ +_ = require('lodash') async = require('async') resin = require('resin-sdk') @@ -25,4 +26,8 @@ exports.set = ] permission: 'user' action: (params, options, done) -> + + if _.isEmpty(params.note) + return done(new Error('Missing note content')) + resin.models.device.note(options.device, params.note, done)