node-ari-client icon indicating copy to clipboard operation
node-ari-client copied to clipboard

Client.prototype.start undefined apps silently dies

Open greenfieldtech-nirs opened this issue 7 years ago • 3 comments

If for some reason, a developer will try to start a Stasis application that has an undefined name (yes, it's stupid, but may happen), Client will not return any type of error or exception.

The issue should be handled within Client.prototype.start (I think):

Client.prototype.start = function (apps, subscribeAll, callback) {
  var self = this;
  // are we currently processing a WebSocket error?
  var processingError = false;

  // Perform argument renaming for backwards compatibility
  if (typeof subscribeAll === 'function') {
    callback = subscribeAll;
    subscribeAll = null;
  }

This may also provide some easy resolution for issue #35

greenfieldtech-nirs avatar Apr 06 '17 21:04 greenfieldtech-nirs

Do you mean if Client.prototype.start is called without an application name, or if Client.prototype.start is called with an application name that does not exist on the Asterisk instance the client is connected to?

samuelg avatar Apr 06 '17 21:04 samuelg

No, what happens is the following:

  1. The start method is invoked with an undefined value for the apps variable
  2. When that happens, node-ari will simply die silently with exit value of 0, not indicating an error.

I do believe that throwing an exception saying: "Stasis Application must define a name" or something like that is a must.

greenfieldtech-nirs avatar Apr 06 '17 21:04 greenfieldtech-nirs

Agreed. I'll see if I can carve out some free time for this soon.

samuelg avatar Apr 06 '17 21:04 samuelg