@@ -296,9 +296,14 @@ StatefulProcessCommandProxy.prototype.executeCommand = function(command) {
296296 self . _pool . acquire ( function ( error , processProxy ) {
297297
298298 if ( error ) {
299- self . _log ( 'error' , "executeCommand[" +
299+
300+ var errMsg = "executeCommand[" +
300301 command + "]: error in acquire: " + error +
301- ' ' + error . stack ) ;
302+ ' ' + error . stack ;
303+
304+ self . _log ( 'error' , errMsg ) ;
305+
306+ reject ( new Error ( errMsg ) ) ;
302307
303308 } else {
304309
@@ -322,9 +327,15 @@ StatefulProcessCommandProxy.prototype.executeCommand = function(command) {
322327 } ) ;
323328
324329 } catch ( e ) {
325- self . _log ( 'error' , "executeCommand[" +
326- command + "]: error: " + e ) ;
330+
331+ var errMsg = "executeCommand[" +
332+ command + "]: error: " + e ;
333+
334+ self . _log ( 'error' , errMsg ) ;
335+
327336 self . _pool . release ( processProxy ) ;
337+
338+ reject ( new Error ( errMsg ) ) ;
328339 }
329340
330341 }
@@ -358,8 +369,12 @@ StatefulProcessCommandProxy.prototype.executeCommands = function(commands) {
358369 self . _pool . acquire ( function ( error , processProxy ) {
359370
360371 if ( error ) {
361- self . _log ( 'error' , "executeCommands: " +
362- "error in acquire: " + error + ' ' + error . stack ) ;
372+ var errMsg = "executeCommands: " +
373+ "error in acquire: " + error + ' ' + error . stack ;
374+
375+ self . _log ( 'error' , errMsg ) ;
376+
377+ reject ( new Error ( errMsg ) ) ;
363378
364379 } else {
365380
@@ -383,8 +398,12 @@ StatefulProcessCommandProxy.prototype.executeCommands = function(commands) {
383398 } ) ;
384399
385400 } catch ( e ) {
386- self . _log ( 'error' , "executeCommands: error: " + e ) ;
401+ var errMsg = "executeCommands: error: " + e ;
402+
403+ self . _log ( 'error' , errMsg ) ;
387404 self . _pool . release ( processProxy ) ;
405+
406+ reject ( new Error ( errMsg ) ) ;
388407 }
389408
390409 }
0 commit comments