.pnp.js
function makeError(code, message, data = {}) {
  const error = new Error(message);
  return Object.assign(error, {code, data});
}
function makeError(code, message, data = {}) {
  const error = new Error(message);
  return Object.assign(error, {code, data});
}
function makeError ( code , message , data = { } ) { const error = new Error ( message ) ; return Object . assign ( error , { code , data } ) ; }
Simple helper function that assign an error code to an error, so that it can more easily be caught and used
by third-parties.
Simple helper function that assign an error code to an error so that it can more easily be caught and used by third - parties .