src/utils.js
function loadKesOverride(kesFolder, kesClass = 'kes.js') {
  let kesOverridePath = path.resolve(kesFolder, kesClass);
  let KesOverride;

  try {
    KesOverride = require(kesOverridePath);
  }
  catch (e) {
    // If the Kes override file exists, then the error occured when
    // trying to parse the file, so re-throw and prevent Kes from
    // going further.
    const fileExists = fs.existsSync(kesOverridePath);
    if (fileExists) {
      throw e;
    }

    console.log(`No Kes override found at ${kesOverridePath}, continuing`);
  }

  return KesOverride;
}
function loadKesOverride(kesFolder, kesClass = 'kes.js') {
  let kesOverridePath = path.resolve(kesFolder, kesClass);
  let KesOverride;

  try {
    KesOverride = require(kesOverridePath);
  }
  catch (e) {
    // If the Kes override file exists, then the error occured when
    // trying to parse the file, so re-throw and prevent Kes from
    // going further.
    const fileExists = fs.existsSync(kesOverridePath);
    if (fileExists) {
      throw e;
    }

    console.log(`No Kes override found at ${kesOverridePath}, continuing`);
  }

  return KesOverride;
}
function loadKesOverride ( kesFolder , kesClass = 'kes.js' ) { let kesOverridePath = path . resolve ( kesFolder , kesClass ) ; let KesOverride ; try { KesOverride = require ( kesOverridePath ) ; } catch ( e ) { // If the Kes override file exists, then the error occured when // trying to parse the file, so re-throw and prevent Kes from // going further. const fileExists = fs . existsSync ( kesOverridePath ) ; if ( fileExists ) { throw e ; } console . log ( ` ${ kesOverridePath } ` ) ; } return KesOverride ; }
Attempt to load a Kes override class.

Throw the error if it is something other than that the Kes override
class does not exist.

@param {string} kesFolder - The folder to look in for a Kes override class
@param {string} kesClass - The path/filename to look for as a Kes override class
@returns {Class} - A Kes override class
Attempt to load a Kes override class .