Skip to content
Myr

hinting at fully resolved paths

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent f1f1261 · Browse files · 1 file+20 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−12 removed

  • other:+20 added−12 removed

1 file+20 added−12 removed

modified:lib/view.js+20 added-12 removed
236 unmodified lines
237 if (!view.exists && options.isLayout) view = new View(orig.rootPath, options);238239 // Does not exist240 if (!view.exists) {241 var msg = 'failed to locate view "' + orig.view + '"';242 if (app.enabled('hints')) {243 console.error();244 console.error(msg + ', tried:');245 console.error(' - ' + orig.path);246 console.error(' - ' + orig.prefixPath);247 console.error(' - ' + orig.indexPath);248 if (!options.isLayout) console.error(' - ' + orig.upIndexPath);249 if (options.isLayout) console.error(' - ' + orig.rootPath);250 console.error();251 }252 throw new Error(msg);241 if (app.enabled('hints')) hintAtViewPaths(orig, options);242 throw new Error('failed to locate view "' + orig.view + '"');243 }244245 // Dynamic helper support246 if (false !== options.dynamicHelpers) {
52 unmodified lines
299 } else {300 this.send(str);301 }302};303304/**305 * Hint at view path resolution, outputting the306 * paths that Express has tried.307 *308 * @api private309 */310311function hintAtViewPaths(view, options) {312 console.error();313 console.error('failed to locate view "' + view.view + '", tried:');314 console.error(' - ' + new View(view.path, options).path);315 console.error(' - ' + new View(view.prefixPath, options).path);316 console.error(' - ' + new View(view.indexPath, options).path);317 if (!options.isLayout) console.error(' - ' + new View(view.upIndexPath, options).path);318 if (options.isLayout) console.error(' - ' + new View(view.rootPath, options).path);319 console.error();320}