MCPcopy
hub / github.com/vercel/hyper / onUnexpectedError

Function onUnexpectedError

bin/yarn-standalone.js:100356–100403  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

100354 };
100355
100356 function onUnexpectedError(err) {
100357 function indent(str) {
100358 return '\n ' + str.trim().split('\n').join('\n ');
100359 }
100360
100361 const log = [];
100362 log.push(`Arguments: ${indent(process.argv.join(' '))}`);
100363 log.push(`PATH: ${indent(process.env.PATH || 'undefined')}`);
100364 log.push(`Yarn version: ${indent((_yarnVersion || _load_yarnVersion()).version)}`);
100365 log.push(`Node version: ${indent(process.versions.node)}`);
100366 log.push(`Platform: ${indent(process.platform + ' ' + process.arch)}`);
100367
100368 log.push(`Trace: ${indent(err.stack)}`);
100369
100370 // add manifests
100371 for (var _iterator3 = (_index2 || _load_index2()).registryNames, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
100372 var _ref4;
100373
100374 if (_isArray3) {
100375 if (_i3 >= _iterator3.length) break;
100376 _ref4 = _iterator3[_i3++];
100377 } else {
100378 _i3 = _iterator3.next();
100379 if (_i3.done) break;
100380 _ref4 = _i3.value;
100381 }
100382
100383 const registryName = _ref4;
100384
100385 const possibleLoc = (_path || _load_path()).default.join(config.cwd, (_index2 || _load_index2()).registries[registryName].filename);
100386 const manifest = (_fs || _load_fs()).default.existsSync(possibleLoc) ? (_fs || _load_fs()).default.readFileSync(possibleLoc, 'utf8') : 'No manifest';
100387 log.push(`${registryName} manifest: ${indent(manifest)}`);
100388 }
100389
100390 // lockfile
100391 const lockLoc = (_path || _load_path()).default.join(config.lockfileFolder || config.cwd, // lockfileFolder might not be set at this point
100392 (_constants || _load_constants()).LOCKFILE_FILENAME);
100393 const lockfile = (_fs || _load_fs()).default.existsSync(lockLoc) ? (_fs || _load_fs()).default.readFileSync(lockLoc, 'utf8') : 'No lockfile';
100394 log.push(`Lockfile: ${indent(lockfile)}`);
100395
100396 const errorReportLoc = writeErrorReport(log);
100397
100398 reporter.error(reporter.lang('unexpectedError', err.message));
100399
100400 if (errorReportLoc) {
100401 reporter.info(reporter.lang('bugReport', errorReportLoc));
100402 }
100403 }
100404
100405 function writeErrorReport(log) {
100406 const errorReportLoc = config.enableMetaFolder ? (_path || _load_path()).default.join(config.cwd, (_constants || _load_constants()).META_FOLDER, 'yarn-error.log') : (_path || _load_path()).default.join(config.cwd, 'yarn-error.log');

Callers 1

yarn-standalone.jsFile · 0.85

Calls 12

indentFunction · 0.85
_load_yarnVersionFunction · 0.85
_load_index2Function · 0.85
_load_pathFunction · 0.85
_load_fsFunction · 0.85
_load_constantsFunction · 0.85
writeErrorReportFunction · 0.85
pushMethod · 0.45
nextMethod · 0.45
errorMethod · 0.45
langMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected