don't stop after an error

https://github.com/nodejs/node/issues/3045#issuecomment-142955116 #367
This commit is contained in:
Romain Beaumont 2016-02-20 17:16:15 +01:00
parent 6fb6b35cc5
commit 33772fafb8
2 changed files with 9 additions and 1 deletions

View file

@ -45,7 +45,7 @@
"buffer-equal": "1.0.0", "buffer-equal": "1.0.0",
"minecraft-data": "^1.0.3", "minecraft-data": "^1.0.3",
"prismarine-nbt": "0.2.1", "prismarine-nbt": "0.2.1",
"protodef": "^1.0.0", "protodef": "^1.0.1",
"readable-stream": "^2.0.5", "readable-stream": "^2.0.5",
"ursa-purejs": "0.0.3", "ursa-purejs": "0.0.3",
"uuid-1345": "^0.99.6", "uuid-1345": "^0.99.6",

View file

@ -58,6 +58,10 @@ class Client extends EventEmitter
const serializerDirection = !this.isServer ? 'toServer' : 'toClient'; const serializerDirection = !this.isServer ? 'toServer' : 'toClient';
e.field = [this.protocolState, serializerDirection].concat(parts).join("."); e.field = [this.protocolState, serializerDirection].concat(parts).join(".");
e.message = `Serialization error for ${e.field} : ${e.message}`; e.message = `Serialization error for ${e.field} : ${e.message}`;
if(!this.compressor)
this.serializer.pipe(this.framer);
else
this.serializer.pipe(this.compressor);
this.emit('error',e); this.emit('error',e);
}); });
@ -68,6 +72,10 @@ class Client extends EventEmitter
const deserializerDirection = this.isServer ? 'toServer' : 'toClient'; const deserializerDirection = this.isServer ? 'toServer' : 'toClient';
e.field = [this.protocolState, deserializerDirection].concat(parts).join("."); e.field = [this.protocolState, deserializerDirection].concat(parts).join(".");
e.message = `Deserialization error for ${e.field} : ${e.message}`; e.message = `Deserialization error for ${e.field} : ${e.message}`;
if(!this.compressor)
this.splitter.pipe(this.deserializer);
else
this.decompressor.pipe(this.deserializer);
this.emit('error',e); this.emit('error',e);
}); });