<commit_before>let EventEmitter = require('events');
let i18next = require('i18next'),
  _ = require('lodash');

const ERROR_LEVEL_FATAL = 'fatal',
  ERROR_LEVEL_ERROR = 'error',
  ERROR_LEVEL_WARN = 'warn',
  ERROR_LEVEL_INFO = 'info',
  ERROR_LEVEL_DEBUG = 'debug',
  ERROR_LEVEL_TRACE = 'trace',
  DEFAULT_ERROR_MESSAGE = "Internal server error!",
  DEFAULT_ERROR_LOCALE = "server.500.generic";



//console.log(i18next.t('server.400.forbidden'))
//console.log(i18next.t('server.400.notFound'))

class RichError{
  constructor(err, options) {
    let i18next = require('i18next')
    i18next.init({
      lng: "en-US",
      nsSeparator: false,
  //keySeparator: false,
  //load:['en-US', 'fr', 'es'],
  //fallbackLng: 'en-US',
  //backend: {
  //  loadPath: '/language/static/{{lng}}/{{ns}}.json'
  //},
      resources: {
        en: {
          translation: { // did a lot of searching, still unsure how this works
        // probably have to load JSON file here
          "server" : {
            "400" : {
              "notFound": "The page could not be found",
              "forbidden": "The page is forbidden",
              "unauthorized": "You are not authorized to access this page"
              }
            }
          // keySeparator must be set to false else 'server.400' is not recognized with '.'
          }
        }
      }
    });
    //initialize logger
    // move constants here<commit_msg>removed comments and added uncaughtException listener<commit_after>let EventEmitter = require('events');
let i18next = require('i18next'),
  _ = require('lodash');

const ERROR_LEVEL_FATAL = 'fatal',
  ERROR_LEVEL_ERROR = 'error',
  ERROR_LEVEL_WARN = 'warn',
  ERROR_LEVEL_INFO = 'info',
  ERROR_LEVEL_DEBUG = 'debug',
  ERROR_LEVEL_TRACE = 'trace',
  DEFAULT_ERROR_MESSAGE = "Internal server error!",
  DEFAULT_ERROR_LOCALE = "server.500.generic";

class RichError{
  constructor(err, options) {
    let i18next = require('i18next')
    i18next.init({
      lng: "en-US",
      nsSeparator: false,
      resources: {
        en: {
          translation: {
          "server" : {
            "400" : {
              "notFound": "The page could not be found",
              "forbidden": "The page is forbidden",
              "unauthorized": "You are not authorized to access this page"
              }
            }
          }
        }
      }
    });
    // move constants here?
{'fraction_non_alphanumeric': 0.1357202331390508, 'fraction_numerical': 0.018734388009991675, 'mean_word_length': 2.3988684582743987, 'pattern_counts': {'":': 6, '<': 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': '64072', 'n_tokens_mistral': 770, 'n_tokens_neox': 742, 'n_words': 181}