Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createChannel() can throw with the callback API #129

Closed
sakai135 opened this issue Jan 21, 2015 · 2 comments
Closed

createChannel() can throw with the callback API #129

sakai135 opened this issue Jan 21, 2015 · 2 comments
Assignees

Comments

@sakai135
Copy link

In the callback API, the createChannel() can throw an error instead of returning the error in the callback.

var amqp = require('amqplib/callback_api');
amqp.connect('amqp://localhost?channelMax=1', function(err, conn) {
  conn.createChannel(function(err) {
    if (err) {
      return console.log(err);
    }
    console.log('callback created 1');
    conn.createChannel(function(err) {
      // does not get called
      if (err) {
        return console.log(err);
      }
      console.log('callback created 2');
    }); // this immediately throws
  });
});
callback created 1

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: No channels left to allocate
    at Connection.C.freshChannel
@squaremo squaremo self-assigned this Jan 21, 2015
@squaremo
Copy link
Collaborator

Yes you are quite right. (And similarly with the promise API, if it doesn't reject the promise.)

@squaremo
Copy link
Collaborator

Fixed in 5770c35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants