lib/protocols.js
function encodeError(err, header) {
  return Buffer.concat([
    header || new Buffer([0]), // Recover the header if possible.
    new Buffer([1, 0]), // Error flag and first union index.
    STRING_TYPE.toBuffer(err.message)
  ]);
}
function encodeError(err, header) {
  return Buffer.concat([
    header || new Buffer([0]), // Recover the header if possible.
    new Buffer([1, 0]), // Error flag and first union index.
    STRING_TYPE.toBuffer(err.message)
  ]);
}
function encodeError ( err , header ) { return Buffer . concat ( [ header || new Buffer ( [ 0 ] ) , // Recover the header if possible. new Buffer ( [ 1 , 0 ] ) , // Error flag and first union index. STRING_TYPE . toBuffer ( err . message ) ] ) ; }
Encode an error and optional header into a valid Avro response.

@param err {Error} Error to encode.
@param header {Object} Optional response header.
Encode an error and optional header into a valid Avro response .