From e3bbb6315e5c1d63b39df0ffa2a759d25a7908b8 Mon Sep 17 00:00:00 2001 From: Karim Guirguis Date: Mon, 31 Jul 2017 16:18:20 -0400 Subject: [PATCH 1/2] dont throw errors --- lib/client.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/client.js b/lib/client.js index dc7b776..060e577 100644 --- a/lib/client.js +++ b/lib/client.js @@ -89,7 +89,7 @@ Client.prototype.runCommand = function (command, arguments) { if( self.status == 'ready' || self.status == 'connecting') { self.client.VimService.VimPort[command]( cmdargs, function ( err, result, raw, soapHeader) { if( err ) { - _soapErrorHandler( self, emitter, command, cmdargs, err ); + return _soapErrorHandler( self, emitter, command, cmdargs, err ); } if( command == 'Logout') { self.status = 'disconnected'; @@ -105,7 +105,7 @@ Client.prototype.runCommand = function (command, arguments) { self.once('ready', function () { self.client.VimService.VimPort[command]( cmdargs, function ( err, result, raw, soapHeader) { if( err ) { - _soapErrorHandler( self, emitter, command, cmdargs, err ); + return _soapErrorHandler( self, emitter, command, cmdargs, err ); } if( command == 'Logout') { self.status = 'disconnected'; @@ -226,15 +226,15 @@ function _soapErrorHandler( self, emitter, command, arguments, err ) { }) .once('error', function (err) { emitter.emit('error',err.body); - throw err; + return emitter; }); } else { emitter.emit('error',err.body); - throw err; + return emitter; } } else { emitter.emit('error',err.body); - throw err; + return emitter; } }; From cf79c9d0450b248f5bc1a812ace74d97940c7f43 Mon Sep 17 00:00:00 2001 From: Karim Guirguis Date: Mon, 21 Aug 2017 15:27:00 -0400 Subject: [PATCH 2/2] remove throwing error --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 060e577..58ae99c 100644 --- a/lib/client.js +++ b/lib/client.js @@ -141,7 +141,7 @@ Client.prototype._connect = function () { soap.createClient(self._vcUrl, self.clientopts, function (err, client) { if( err ) { self.emit('error',err); - throw err; + return; } self.client = client; // save client for later use