<commit_before>'use strict';

var _ = require('lodash');

module.exports = (function() {
  var xError = function (code, message, data) {
    data = data
        || (typeof message !== 'string' && message)
        || (typeof code !== 'number' && typeof code !== 'string' && code )
        || {};
    message =  (typeof message === 'string' && message)
        || (typeof code === 'string' && code)
        || undefined;
    code = (typeof code ==='number') ? code
        : undefined;
    
    this.extend(data);
    this.setMsg(message);
    this.setCode(code);
    
    this.name = 'xError';
    
    Error.captureStackTrace(this, xError); // avoid polluting the stack
    
    // modify stack's getter and setter methods to make enumerable by JSON.stringify()
    var _stack = this.stack; // activate the getter
    this.__defineGetter__('stack', function() { return _stack; });
    this.__defineSetter__('stack', function(stack) {  _stack = stack; });

    return this;
  };

  xError.prototype = new Error(); // inherit Error
  xError.prototype.constructor = Error; // ensure xError is an instance of Error

  xError.prototype.setCode = xError.prototype.c = function(code) {
    if (typeof code !== 'undefined') { this.code = code; }
    return this;
  };
  xError.prototype.setMsg = xError.prototype.m = function(message) {
    if (typeof message !== 'undefined') { this.message = message; }
    return this;
  };
  xError.prototype.severity = xError.prototype.s = function(severity) {
    if (typeof severity !== 'undefined') { this.severity = severity; }
    return this;
  };
  xError.prototype.setHttpCode =  xError.prototype.hc = function(httpCode) {
    if (typeof httpCode === 'number') { this.httpCode = httpCode; }
    return this;
  };
  xError.prototype.setHttpResponse = xError.prototype.hr = function(httpResponse) {
    if (typeof httpResponse !== 'undefined') { this.httpResponse = httpResponse; }
    return this;
  };<commit_msg>added message delete, removed name<commit_after>'use strict';

var _ = require('lodash');

module.exports = (function() {
  var xError = function xError(code, message, data) {
    data = data
        || (typeof message !== 'string' && message)
        || (typeof code !== 'number' && typeof code !== 'string' && code )
        || {};
    message =  (typeof message === 'string' && message)
        || (typeof code === 'string' && code)
        || undefined;
    code = (typeof code ==='number') ? code
        : undefined;
    
    this.extend(data);
    this.setMsg(message);
    this.setCode(code);
    
    Error.captureStackTrace(this, xError); // avoid polluting the stack
    
    // modify stack's getter and setter methods to make the property enumerable by JSON.stringify()
    var _stack = this.stack; // activate the getter
    this.__defineGetter__('stack', function() { return _stack; });
    this.__defineSetter__('stack', function(stack) {  _stack = stack; });

    return this;
  };

  xError.prototype = new Error(); // inherit Error
  delete xError.message;

  //xError.prototype.constructor = Error; // ensure xError is an instance of Error

  xError.prototype.setCode = xError.prototype.c = function(code) {
    if (typeof code !== 'undefined') { this.code = code; }
    return this;
  };
  xError.prototype.setMsg = xError.prototype.m = function(message) {
    if (typeof message !== 'undefined') { this.message = message; }
    return this;
  };
  xError.prototype.setSeverity = xError.prototype.s = function(severity) {
    if (typeof severity !== 'undefined') { this.severity = severity; }
    return this;
  };
  xError.prototype.setHttpCode =  xError.prototype.hc = function(httpCode) {
    if (typeof httpCode === 'number') { this.httpCode = httpCode; }
    return this;
  };
  xError.prototype.setHttpResponse = xError.prototype.hr = function(httpResponse) {
    if (typeof httpResponse !== 'undefined') { this.httpResponse = httpResponse; }
    return this;
  };
{'fraction_non_alphanumeric': 0.14713343480466767, 'fraction_numerical': 0.0, 'mean_word_length': 3.150526315789474, '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': '2679445', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1152, 'n_words': 302}