Permalink
Browse files

Merge pull request #58 from CodeMonkeySteve/master

Only log to console if console defined
  • Loading branch information...
2 parents 7627161 + 93cd7d6 commit 8dc7445460d80756171df2c3758d65af44bb235d @creationix committed Feb 2, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/haml.js
View
2 lib/haml.js
@@ -633,7 +633,7 @@ var Haml;
var f = new Function("locals", escaper + str );
return f;
}catch(e){
- console.error(str);
+ if ( typeof(console) !== 'undefined' ) { console.error(str); }
throw e;
}
}

1 comment on commit 8dc7445

@hoprocker

A more comprehensive way to do this might be to add something early on like this:

if(typeof(console) === "undefined") {
console = {
error : function() {},
info : function() {},
warning : function() {}
etc

Please sign in to comment.