Skip to content

Commit

Permalink
fix(sasl): pass errors to callback, don't throw
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwe committed Oct 20, 2016
1 parent db6295f commit c5b11ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/sasl.js
Expand Up @@ -66,8 +66,8 @@ Sasl.prototype._processFrame = function(frame) {
var mechanisms = Array.isArray(frame.saslServerMechanisms) ?
frame.saslServerMechanisms.map(function(m) { return m.value; }) : frame.saslServerMechanisms;
if (!u.includes(mechanisms, mechanism)) {
throw new errors.AuthenticationError(
'SASL ' + mechanism + ' not supported by remote.');
this.callback(new errors.AuthenticationError(
'SASL ' + mechanism + ' not supported by remote.'));
}
if (mechanism === Sasl.Mechanism.PLAIN) {
debug('Sending ' + this.credentials.user + ':' + this.credentials.pass);
Expand All @@ -82,8 +82,8 @@ Sasl.prototype._processFrame = function(frame) {
}
buf.appendUInt8(0); // <null>
} else {
throw new errors.NotImplementedError(
'Only SASL PLAIN and ANONYMOUS are supported.');
this.callback(new errors.NotImplementedError(
'Only SASL PLAIN and ANONYMOUS are supported.'));
}
var initFrame = new frames.SaslInitFrame({
mechanism: mechanism,
Expand Down

0 comments on commit c5b11ee

Please sign in to comment.