Standardize callback and cleanup code.

This should emit `this.connection.emit('error', err);`