diff --git a/examples/error_not_found.txt b/examples/error_not_found.txt index fc8d6b7..8b13789 100644 --- a/examples/error_not_found.txt +++ b/examples/error_not_found.txt @@ -1 +1 @@ -ERROR: 'foo' not found in context + diff --git a/mustache.js b/mustache.js index 5050936..e52b378 100644 --- a/mustache.js +++ b/mustache.js @@ -158,7 +158,8 @@ var Mustache = function() { if(context[name] !== undefined) { return context[name]; } - throw({message: "'" + name + "' not found in context"}); + // silently ignore unkown variables + return ""; }, // Utility methods diff --git a/test/mustache_spec.rb b/test/mustache_spec.rb index f4bbb22..6f8a1bf 100644 --- a/test/mustache_spec.rb +++ b/test/mustache_spec.rb @@ -37,7 +37,7 @@ describe "mustache" do print('ERROR: ' + e.message); } JS - run_js(js).should == "ERROR: 'x' not found in context\n" + run_js(js).should == "\n" end non_partials.each do |testname|