function handle_load_error(err, found, plugin_desc, eraro) {
  plugin_desc.err = err
  plugin_desc.found = found

  plugin_desc.found_name = plugin_desc.found.name
  plugin_desc.err_msg = err.message

  // Syntax error inside the plugin code.
  // Unfortunately V8 does not give us location info.
  // It does print a complaint to STDERR, so need to tell user to look there.
  if (err instanceof SyntaxError) {
    return eraro('syntax_error', plugin_desc)
  }

  // Not what you think!
  // This covers the case where the plugin contains
  // _require_ calls that themselves fail.
  else if ('MODULE_NOT_FOUND' == err.code) {
    plugin_desc.err_msg = err.stack.replace(/\n.*\(module\.js:.*/g, '')
    plugin_desc.err_msg = plugin_desc.err_msg.replace(/\s+/g, ' ')
    return eraro('require_failed', plugin_desc)
  }

  // The require call failed for some other reason.
  else {
    return eraro('load_failed', plugin_desc)
  }
}
// This code deals with the known failure cases.
This code deals with the known failure cases.
This code deals with the known failure cases .
function handle_load_error(err, found, plugin_desc, eraro) {
  plugin_desc.err = err
  plugin_desc.found = found
  plugin_desc.found_name = plugin_desc.found.name
  plugin_desc.err_msg = err.message
  if (err instanceof SyntaxError) {
    return eraro('syntax_error', plugin_desc)
  }
  else if ('MODULE_NOT_FOUND' == err.code) {
    plugin_desc.err_msg = err.stack.replace(/\n.*\(module\.js:.*/g, '')
    plugin_desc.err_msg = plugin_desc.err_msg.replace(/\s+/g, ' ')
    return eraro('require_failed', plugin_desc)
  }
  else {
    return eraro('load_failed', plugin_desc)
  }
}
function handle_load_error ( err , found , plugin_desc , eraro ) { plugin_desc . err = err plugin_desc . found = found plugin_desc . found_name = plugin_desc . found . name plugin_desc . err_msg = err . message if ( err instanceof SyntaxError ) { return eraro ( 'syntax_error' , plugin_desc ) } else if ( 'MODULE_NOT_FOUND' == err . code ) { plugin_desc . err_msg = err . stack . replace ( / \n.*\(module\.js:.* / g , '' ) plugin_desc . err_msg = plugin_desc . err_msg . replace ( / \s+ / g , ' ' ) return eraro ( 'require_failed' , plugin_desc ) } else { return eraro ( 'load_failed' , plugin_desc ) } }
This code deals with the known failure cases.
This code deals with the known failure cases .
// Syntax error inside the plugin code. // Unfortunately V8 does not give us location info. // It does print a complaint to STDERR, so need to tell user to look there. // Not what you think! // This covers the case where the plugin contains // _require_ calls that themselves fail. // The require call failed for some other reason.