<commit_before>var httpStatusCodes = require('http').STATUS_CODES;
var util            = require('util');
var camelCase       = require('lodash.camelcase');
var capitalize      = require('lodash.capitalize');

/**
 * @param {Number}        [statusCode=500]
 * @param {Object|String} [propertiesOrMessage]
 * @param {Object}        [properties]
 */
function HttpError(statusCode, propertiesOrMessage, properties) {
    Error.call(this);
    Error.captureStackTrace(this, this.constructor);

    statusCode = statusCode || 500;
    properties = properties || {};

    if (propertiesOrMessage instanceof Object) {
        properties = propertiesOrMessage;
    } else if (typeof propertiesOrMessage === 'string') {
        properties.message = propertiesOrMessage;
    }

    Object.assign(this, properties);

    this.name       = upperCamelCase(httpStatusCodes[statusCode]);
    this.statusCode = statusCode;
    this.status     = statusCode;
    this.message    = this.message || httpStatusCodes[statusCode];

    Object.defineProperties(this, {
        statusCode: { enumerable: false },
        status:     { enumerable: false },
        name:       { enumerable: false }
    });
}

util.inherits(HttpError, Error);

Object.keys(httpStatusCodes).forEach(function(statusCode) {
    if (statusCode >= 400) {
        var upperCamelCasedStatusMessage = upperCamelCase(httpStatusCodes[statusCode]);

        HttpError[upperCamelCasedStatusMessage] = function(propertiesOrMessage, properties) {
            HttpError.call(this, statusCode, propertiesOrMessage, properties);
        };

        util.inherits(HttpError[upperCamelCasedStatusMessage], HttpError);
    }
});

function upperCamelCase(string) {
    return capitalize(camelCase(string));
}

module.exports = HttpError;<commit_msg>HttpError[<statusCode>] constructor<commit_after>var httpStatusCodes = require('http').STATUS_CODES;
var util            = require('util');
var camelCase       = require('lodash.camelcase');
var capitalize      = require('lodash.capitalize');

/**
 * @param {Number}        [statusCode=500]
 * @param {Object|String} [propertiesOrMessage]
 * @param {Object}        [properties]
 */
function HttpError(statusCode, propertiesOrMessage, properties) {
    Error.call(this);
    Error.captureStackTrace(this, this.constructor);

    statusCode = statusCode || 500;
    properties = properties || {};

    if (propertiesOrMessage instanceof Object) {
        properties = propertiesOrMessage;
    } else if (typeof propertiesOrMessage === 'string') {
        properties.message = propertiesOrMessage;
    }

    Object.assign(this, properties);

    this.name       = upperCamelCase(httpStatusCodes[statusCode]);
    this.statusCode = statusCode;
    this.status     = statusCode;
    this.message    = this.message || httpStatusCodes[statusCode];

    Object.defineProperties(this, {
        statusCode: { enumerable: false },
        status:     { enumerable: false },
        name:       { enumerable: false }
    });
}

util.inherits(HttpError, Error);

Object.keys(httpStatusCodes).forEach(function(statusCode) {
    if (statusCode >= 400) {
        var SpecificHttpError = function(propertiesOrMessage, properties) {
            HttpError.call(this, statusCode, propertiesOrMessage, properties);
        };

        var upperCamelCasedStatusMessage        = upperCamelCase(httpStatusCodes[statusCode]);
        HttpError[upperCamelCasedStatusMessage] = SpecificHttpError;

        HttpError[statusCode] = SpecificHttpError;

        util.inherits(SpecificHttpError, HttpError);
    }
});

function upperCamelCase(string) {
    return capitalize(camelCase(string));
}

module.exports = HttpError;
{'fraction_non_alphanumeric': 0.11576086956521739, 'fraction_numerical': 0.004891304347826087, 'mean_word_length': 3.5613382899628254, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6751522', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1008, 'n_words': 187}