Throw a meaningful error when there is no default engine

Esse commit está contido em:
Forbes Lindesay
2013-05-15 03:18:09 +02:00
commit de ForbesLindesay
commit 30919be2a0
+1
Ver Arquivo
@@ -38,6 +38,7 @@ function View(name, options) {
var engines = options.engines;
this.defaultEngine = options.defaultEngine;
var ext = this.ext = extname(name);
if (!ext && !this.defaultEngine) throw new Error('No default engine was specified and no extension was provided.');
if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine);
this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express);
this.path = this.lookup(name);