Improve parser error handling
In cases where one side of the connection is not communicated with valid ASN.1/BER, it would be better to fire an error event rather than let the exception bubble all the way up. Fix mcavage/node-ldapjs#142
This commit is contained in:
parent
d20308265a
commit
7c7c480eb8
|
@ -113,8 +113,14 @@ Parser.prototype.getMessage = function (ber) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var messageID = ber.readInt();
|
try {
|
||||||
var type = ber.readSequence();
|
var messageID = ber.readInt();
|
||||||
|
var type = ber.readSequence();
|
||||||
|
} catch (e) {
|
||||||
|
// Handle servers that aren't speaking the language at all
|
||||||
|
this.emit('error', e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var Message;
|
var Message;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
Loading…
Reference in New Issue