asterisk / node-ari-client

Node.js client for ARI. This library is best effort with limited support.
Other
253 stars 99 forks source link

Client.prototype.start undefined apps silently dies #86

Open greenfieldtech-nirs opened 7 years ago

greenfieldtech-nirs commented 7 years ago

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

samuelg commented 7 years ago

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?

greenfieldtech-nirs commented 7 years ago

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.

samuelg commented 7 years ago

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