examples/node_error.js
function parseError(error) {
  // If this file is at the root of your project
  var pathRegexp = new RegExp(__dirname, 'g');
  var display = '';
  if (error.code) { display += 'Error code: ' + error.code + '\n\n' };
  if (error.stack) { display += error.stack.replace(pathRegexp, ''); }
  if (!display) { display = error.toString(); }
  return display;
}
function parseError(error) {
  // If this file is at the root of your project
  var pathRegexp = new RegExp(__dirname, 'g');
  var display = '';
  if (error.code) { display += 'Error code: ' + error.code + '\n\n' };
  if (error.stack) { display += error.stack.replace(pathRegexp, ''); }
  if (!display) { display = error.toString(); }
  return display;
}
function parseError ( error ) { // If this file is at the root of your project var pathRegexp = new RegExp ( __dirname , 'g' ) ; var display = '' ; if ( error . code ) { display += 'Error code: ' + error . code + '\n\n' } ; if ( error . stack ) { display += error . stack . replace ( pathRegexp , '' ) ; } if ( ! display ) { display = error . toString ( ) ; } return display ; }
Extract stack and hide user paths
Extract stack and hide user paths