Now just throws straight strings.with-js-extras
| @@ -30,10 +30,10 @@ var Mustache = function() { | |||||
| */ | */ | ||||
| render_partial: function(name, context, partials) { | render_partial: function(name, context, partials) { | ||||
| if(typeof(context[name]) != "object") { | if(typeof(context[name]) != "object") { | ||||
| throw({message: "Context for '" + name + "' is not an object."}); | |||||
| throw("Context for '" + name + "' is not an object."); | |||||
| } | } | ||||
| if(!partials || !partials[name]) { | if(!partials || !partials[name]) { | ||||
| throw({message: "No template for partial '" + name + "'."}); | |||||
| throw("No template for partial '" + name + "'."); | |||||
| } | } | ||||
| return this.render(partials[name], context[name], partials); | return this.render(partials[name], context[name], partials); | ||||
| }, | }, | ||||
| @@ -169,7 +169,7 @@ var Mustache = function() { | |||||
| } else { | } else { | ||||
| src = context.toString(); | src = context.toString(); | ||||
| } | } | ||||
| throw({message: "'" + name + "' not found in context: " + src}); | |||||
| throw("'" + name + "' not found in context: " + src); | |||||
| } | } | ||||
| ctx = ctx[p]; | ctx = ctx[p]; | ||||
| } | } | ||||
| @@ -34,7 +34,7 @@ describe "mustache" do | |||||
| try { | try { | ||||
| print(Mustache.to_html("{{#list}}{{x}}{{/list}}", {list: [{}]})); | print(Mustache.to_html("{{#list}}{{x}}{{/list}}", {list: [{}]})); | ||||
| } catch(e) { | } catch(e) { | ||||
| print('ERROR: ' + e.message); | |||||
| print('ERROR: ' + e); | |||||
| } | } | ||||
| JS | JS | ||||
| run_js(js).should == "ERROR: 'x' not found in context: {list:[{}]}\n" | run_js(js).should == "ERROR: 'x' not found in context: {list:[{}]}\n" | ||||
| @@ -54,7 +54,7 @@ describe "mustache" do | |||||
| var result = Mustache.to_html(template, #{testname}); | var result = Mustache.to_html(template, #{testname}); | ||||
| print(result); | print(result); | ||||
| } catch(e) { | } catch(e) { | ||||
| print('ERROR: ' + e.message); | |||||
| print('ERROR: ' + e); | |||||
| } | } | ||||
| JS | JS | ||||
| @@ -79,7 +79,7 @@ describe "mustache" do | |||||
| var result = Mustache.to_html(template, partial_context, partials); | var result = Mustache.to_html(template, partial_context, partials); | ||||
| print(result); | print(result); | ||||
| } catch(e) { | } catch(e) { | ||||
| print('ERROR: ' + e.message); | |||||
| print('ERROR: ' + e); | |||||
| } | } | ||||
| JS | JS | ||||