I think this should be:

```js
if (parsed.error) {
  this.emit(parsed.error);
  this.end("ProtocolError");
}
```

This way your server can do something like:

```js
client.on('error', function(err) {
  // do something with err.message, err.stack, or both.
  // or not
});
```

And if the server does not add an 'error' event, the server will crash with the error message. This is idiomatic node.js.