MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / _showObjErrors

Method _showObjErrors

lib/models/package-info-cache/index.js:93–144  ·  view source on GitHub ↗

* Dump all the errors for a single object in the cache out to the ui-console. * * Special case: because package-info-cache also creates PackageInfo objects for entries * that do not actually exist (to allow simplifying the code), if there's a case where * an object has only the single er

(obj)

Source from the content-addressed store, hash-verified

91 * @method _showObjErrors
92 */
93 _showObjErrors(obj) {
94 let errorEntries = obj.hasErrors() ? obj.errors.getErrors() : null;
95
96 if (!errorEntries || (errorEntries.length === 1 && errorEntries[0].type === Errors.ERROR_PACKAGE_DIR_MISSING)) {
97 return;
98 }
99
100 logger.info('');
101 let rootPath;
102
103 if (obj instanceof PackageInfoCache) {
104 logger.info('Top level errors:');
105 rootPath = this.realPath || '';
106 } else {
107 let typeName = obj.project ? 'project' : 'addon';
108
109 logger.info(`The 'package.json' file for the ${typeName} at ${obj.realPath}`);
110 rootPath = obj.realPath;
111 }
112
113 errorEntries.forEach((errorEntry) => {
114 switch (errorEntry.type) {
115 case Errors.ERROR_PACKAGE_JSON_MISSING:
116 logger.info(` does not exist`);
117 break;
118 case Errors.ERROR_PACKAGE_JSON_PARSE:
119 logger.info(` could not be parsed`);
120 break;
121 case Errors.ERROR_EMBER_ADDON_MAIN_MISSING:
122 logger.info(
123 ` specifies a missing ember-addon 'main' file at relative path '${path.relative(
124 rootPath,
125 errorEntry.data
126 )}'`
127 );
128 break;
129 case Errors.ERROR_DEPENDENCIES_MISSING:
130 if (errorEntry.data.length === 1) {
131 logger.info(` specifies a missing dependency '${errorEntry.data[0]}'`);
132 } else {
133 logger.info(` specifies some missing dependencies:`);
134 errorEntry.data.forEach((dependencyName) => {
135 logger.info(` ${dependencyName}`);
136 });
137 }
138 break;
139 case Errors.ERROR_NODEMODULES_ENTRY_MISSING:
140 logger.info(` specifies a missing 'node_modules/${errorEntry.data}' directory`);
141 break;
142 }
143 });
144 }
145
146 /**
147 * Process the root directory of a project, given a

Callers 1

showErrorsMethod · 0.95

Calls 2

getErrorsMethod · 0.80
hasErrorsMethod · 0.45

Tested by

no test coverage detected