From a2a79605c76675d039cf0e90858037313736c297 Mon Sep 17 00:00:00 2001 From: micodix <80091840+micodix@users.noreply.github.com> Date: Thu, 13 Oct 2022 22:41:00 +0200 Subject: [PATCH] support for 'autherror' event --- lib/ami.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;