Skip to content

Commit

Permalink
Devices API: Don't throw, just callback errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas committed Oct 29, 2013
1 parent d1107a7 commit f5bf6c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/api/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ var set = function(key) {

exports.link = function(data, cb) {
if (keys.get().device)
throw (errors.get('DEVICE_KEY_SET'));
return cb(errors.get('DEVICE_KEY_SET'));
else if (!keys.get().api)
throw (errors.get('NO_API_KEY'));
return cb(errors.get('NO_API_KEY'));

request.post('/devices.json', data, {}, function(err, resp, body){
if (err) return cb(err);
Expand All @@ -39,7 +39,7 @@ exports.link = function(data, cb) {

exports.unlink = function(cb){
if (!keys.get().api || !keys.get().device)
throw (errors.get('MISSING_KEY'));
return cb(errors.get('MISSING_KEY'));

request.delete('/devices/' + keys.get().device, {}, function(err, resp, body) {
if (err) return cb(err);
Expand Down

0 comments on commit f5bf6c6

Please sign in to comment.