lib/receiver.js
function error(ErrorCtor, message, prefix, statusCode) {
  const err = new ErrorCtor(
    prefix ? `Invalid WebSocket frame: ${message}` : message
  );

  Error.captureStackTrace(err, error);
  err[kStatusCode] = statusCode;
  return err;
}
function error(ErrorCtor, message, prefix, statusCode) {
  const err = new ErrorCtor(
    prefix ? `Invalid WebSocket frame: ${message}` : message
  );

  Error.captureStackTrace(err, error);
  err[kStatusCode] = statusCode;
  return err;
}
function error ( ErrorCtor , message , prefix , statusCode ) { const err = new ErrorCtor ( prefix ? ` ${ message } ` : message ) ; Error . captureStackTrace ( err , error ) ; err [ kStatusCode ] = statusCode ; return err ; }
Builds an error object.

@param {(Error|RangeError)} ErrorCtor The error constructor
@param {String} message The error message
@param {Boolean} prefix Specifies whether or not to add a default prefix to
`message`
@param {Number} statusCode The status code
@return {(Error|RangeError)} The error
@private
Builds an error object .