<commit_before>

/* Constants */

var ERR_UNKNOWN = 'ERR_UNKNOWN';
var ERR_NO_MATCH_FOUND = 'ERR_NO_MATCH_FOUND';
var ERR_HOSTNAME_UNDEFINED = 'ERR_HOSTNAME_UNDEFINED';
var ERR_NO_SUCH_ENVIRONMENT = 'ERR_NO_SUCH_ENVIRONMENT';


/* Read-only property setter */

function addReadonly (props) {

    return {

        to: function (object) {

            var keys = Object.keys(props);
            keys.forEach(function (key) {

                Object.defineProperty(object, key, {
                    value: props[key],
                    writable: false,
                    enumerable: true,
                    configurable: false,
                });

            });

        },

    };

}


/* EnvLookupError */

function EnvLookupError (e) {

    e = e || {};

    var code = e.code || ERR_UNKNOWN;
    var hostname = e.hostname || '';

    var message = e.message || 'Environment lookup failed: ' + code;
    Error.call(this, message);

    this.code = code;
    this.hostname = hostname;

}

EnvLookupError.prototype = Object.create(Error.prototype);
EnvLookupError.prototype.constructor = EnvLookupError;


/* EnvAlreadyExistsError */

function EnvAlreadyExistsError (e) {

    e = e || {};

    var environmentName = e.environmentName || '';
    var message = 'Environment "' + environmentName + '" already exists';

    Error.call(this, message);

    this.code = ERR_ENVIRONMENT_ALREADY_EXISTS;
    this.environmentName = environmentName;

}

EnvAlreadyExistsError.prototype = Object.create(Error.prototype);
EnvAlreadyExistsError.prototype.constructor = EnvAlreadyExistsError;


/* UnknownEnvNameError */

function UnknownEnvNameError (e) {

    e = e || {};

    var environmentName = e.environmentName || '';

    var message = 'No config for environment name "' + environmentName + '"';
    Error.call(this, message);

    this.code = ERR_NO_SUCH_ENVIRONMENT;
    this.environmentName = environmentName;

}

UnknownEnvNameError.prototype = Object.create(Error.prototype);
UnknownEnvNameError.prototype.constructor = UnknownEnvNameError;<commit_msg>fix(errors): Fixed erroneous custom error types<commit_after>

/* Constants */

var ERR_UNKNOWN = 'ERR_UNKNOWN';
var ERR_NO_MATCH_FOUND = 'ERR_NO_MATCH_FOUND';
var ERR_HOSTNAME_UNDEFINED = 'ERR_HOSTNAME_UNDEFINED';
var ERR_NO_SUCH_ENVIRONMENT = 'ERR_NO_SUCH_ENVIRONMENT';
var ERR_ENVIRONMENT_ALREADY_EXISTS = 'ERR_ENVIRONMENT_ALREADY_EXISTS';


/* Read-only property setter */

function addReadonly (props) {

    return {

        to: function (object) {

            var keys = Object.keys(props);
            keys.forEach(function (key) {

                Object.defineProperty(object, key, {
                    value: props[key],
                    writable: false,
                    enumerable: true,
                    configurable: false,
                });

            });

        },

    };

}


/* EnvLookupError */

function EnvLookupError (e) {

    e = e || {};

    var code = e.code || ERR_UNKNOWN;
    var hostname = e.hostname || '';

    this.message = e.message || 'Environment lookup failed: ' + code;
    this.code = code;
    this.hostname = hostname;

}

EnvLookupError.prototype = Object.create(Error.prototype);
EnvLookupError.prototype.constructor = EnvLookupError;


/* EnvAlreadyExistsError */

function EnvAlreadyExistsError (e) {

    e = e || {};

    var environmentName = e.environmentName || '';

    this.message = 'Environment "' + environmentName + '" already exists';

    this.code = ERR_ENVIRONMENT_ALREADY_EXISTS;
    this.environmentName = environmentName;

}

EnvAlreadyExistsError.prototype = Object.create(Error.prototype);
EnvAlreadyExistsError.prototype.constructor = EnvAlreadyExistsError;


/* UnknownEnvNameError */

function UnknownEnvNameError (e) {

    e = e || {};

    var environmentName = e.environmentName || '';

    this.message = 'No config for environment name "' + environmentName + '"';
    this.code = ERR_NO_SUCH_ENVIRONMENT;
    this.environmentName = environmentName;

}

UnknownEnvNameError.prototype = Object.create(Error.prototype);
UnknownEnvNameError.prototype.constructor = UnknownEnvNameError;
{'fraction_non_alphanumeric': 0.11229171697657571, 'fraction_numerical': 0.0, 'mean_word_length': 2.9712368168744008, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1247716', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1199, 'n_words': 240}