Skip to content

Commit

Permalink
Merge pull request #191 from jessetane/master
Browse files Browse the repository at this point in the history
Always catch runtime errors, even when `minify` option is `false`
  • Loading branch information
bminer committed Oct 9, 2013
2 parents f1b26a4 + 2ecd5bd commit ddc8f3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ Compiler.prototype.compile = function(cb) {
//Only include error handling and source code, if needed
if(this.options.minify !== true && this.options.includeSource)
this._pushOff(ns + '.source = ' + JSON.stringify(this.string) + ";");
if(this.options.minify !== true)
this._pushOff("\ntry {");
this._pushOff("\ntry {");
//Now compile the template
this._pushOff('with(' + ns + '.locals) {');
for(var i = 0; i < this.ast.doctypes.length; i++)
Expand All @@ -118,6 +117,8 @@ Compiler.prototype.compile = function(cb) {
//Close main `try` and insert `catch`
if(this.options.minify !== true)
this._pushOff("} catch(e){return cb(" + ns + ".r.rethrow(e, " + ns + ") );}");
else
this._pushOff("} catch(e){return cb(e);}");
//End of template callback
this._pushOff('if(!' + ns + '.inc) ' + ns + '.r.done(' + ns + ');');
if(this.blockDeclarations)
Expand Down

0 comments on commit ddc8f3b

Please sign in to comment.