diff --git a/lib/ami.js b/lib/ami.js index ab6b5f6..e3a1bec 100644 --- a/lib/ami.js +++ b/lib/ami.js @@ -211,7 +211,10 @@ function ManagerLogin(context, callback) { 'secret': options.password, 'event': options.events ? 'on' : 'off' }, (function(err) { - if (err) return callback(err); + if (err) { + process.nextTick(this.emit.bind(this, 'autherror', new Error(err.message))); + return callback(err); + } process.nextTick(callback.bind(this)); context.authenticated = true;