Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devicestack

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devicestack - npm Package Compare versions

Comparing version 1.9.4 to 1.9.5

21

lib/connection.js

@@ -76,8 +76,15 @@ var EventEmitter2 = require('eventemitter2').EventEmitter2,

if (self.onConnecting) {
self.onConnecting(function() {
if (self.log) self.log('connect connection with id ' + self.id);
self.device.emit('connect', self.device);
self.set('state', 'connect');
self.emit('connect', self);
if (callback) callback(null, self);
self.onConnecting(function(err) {
if (err) {
if (self.log) self.log('could not connect connection with id ' + self.id);
self.close(function() {
if (callback) callback(err, self);
});
} else {
if (self.log) self.log('connect connection with id ' + self.id);
self.device.emit('connect', self.device);
self.set('state', 'connect');
self.emit('connect', self);
if (callback) callback(null, self);
}
});

@@ -186,3 +193,3 @@ } else {

Connection.prototype.close = function(callback) {
if (this.get('state') !== 'connect') {
if (this.get('state') !== 'connect' && this.get('state') !== 'connecting') {
if (callback) callback(new Error('Connection is already "' + this.get('state') + '"!'));

@@ -189,0 +196,0 @@ return;

@@ -318,9 +318,12 @@ var util = require('util'),

if (err) {
if (self.log) self.log('Error while calling connect: ' + JSON.stringify(err));
if (!err.name) {
err = new Error(err);
}
if (self.log) self.log('Error while calling connect: ' + err.name + (err.message ? ': ' + err.message : ''));
if (callback) {
if (!err.name) {
err = new Error(err);
}
callback(err, connection);
}
self.emit('disconnect', connection);
self.emit('connectionStateChanged', { state: 'disconnect', connection: connection, device: device });
return;

@@ -327,0 +330,0 @@ }

{
"name": "devicestack",
"version": "1.9.4",
"version": "1.9.5",
"description": "This module helps you to represent a device and its protocol.",

@@ -30,6 +30,8 @@ "private": false,

"mocha": ">=1.0.1",
"expect.js": ">=0.1.2"
"expect.js": ">=0.1.2",
"istanbul": ">=0.1.44"
},
"scripts": {
"test": "mocha"
"test": "mocha",
"cov": "istanbul cover _mocha"
},

@@ -36,0 +38,0 @@ "repository": {

@@ -0,1 +1,4 @@

## v1.9.5
- handle errors while connecting
## v1.9.4

@@ -2,0 +5,0 @@ - do not call callback twice if error is throwing on consumer callback

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc