createError(ErrorCtor, message, prefix, statusCode, errorCode) {
    this._loop = false;
    this._errored = true;

    const err = new ErrorCtor(
      prefix ? `Invalid WebSocket frame: ${message}` : message
    );

    Error.captureStackTrace(err, this.createError);
    err.code = errorCode;
    err[kStatusCode] = statusCode;
    return err;
  }
Builds an error object.

@param {function(new: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
@param {String} errorCode The exposed error code
@return {(Error|RangeError)} The error
@private