Browse Source

Using e.messages is unhelpful in the console.

Now just throws straight strings.
with-js-extras
Paul J. Davis 16 years ago
parent
commit
02ebf69e04
2 changed files with 6 additions and 6 deletions
  1. +3
    -3
      mustache.js
  2. +3
    -3
      test/mustache_spec.rb

+ 3
- 3
mustache.js View File

@@ -30,10 +30,10 @@ var Mustache = function() {
*/
render_partial: function(name, context, partials) {
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]) {
throw({message: "No template for partial '" + name + "'."});
throw("No template for partial '" + name + "'.");
}
return this.render(partials[name], context[name], partials);
},
@@ -169,7 +169,7 @@ var Mustache = function() {
} else {
src = context.toString();
}
throw({message: "'" + name + "' not found in context: " + src});
throw("'" + name + "' not found in context: " + src);
}
ctx = ctx[p];
}


+ 3
- 3
test/mustache_spec.rb View File

@@ -34,7 +34,7 @@ describe "mustache" do
try {
print(Mustache.to_html("{{#list}}{{x}}{{/list}}", {list: [{}]}));
} catch(e) {
print('ERROR: ' + e.message);
print('ERROR: ' + e);
}
JS
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});
print(result);
} catch(e) {
print('ERROR: ' + e.message);
print('ERROR: ' + e);
}
JS

@@ -79,7 +79,7 @@ describe "mustache" do
var result = Mustache.to_html(template, partial_context, partials);
print(result);
} catch(e) {
print('ERROR: ' + e.message);
print('ERROR: ' + e);
}
JS


Loading…
Cancel
Save