Bläddra i källkod

Fix error message consistency.

tags/0.2
Paul J. Davis 16 år sedan
förälder
incheckning
895e741234
5 ändrade filer med 6 tillägg och 3 borttagningar
  1. +1
    -0
      examples/error_not_found.html
  2. +1
    -0
      examples/error_not_found.js
  3. +1
    -0
      examples/error_not_found.txt
  4. +1
    -1
      mustache.js
  5. +2
    -2
      test/mustache_spec.rb

+ 1
- 0
examples/error_not_found.html Visa fil

@@ -0,0 +1 @@
{{foo}}

+ 1
- 0
examples/error_not_found.js Visa fil

@@ -0,0 +1 @@
var error_not_found = {bar: 2};

+ 1
- 0
examples/error_not_found.txt Visa fil

@@ -0,0 +1 @@
ERROR: 'foo' not found in context

+ 1
- 1
mustache.js Visa fil

@@ -136,7 +136,7 @@ var Mustache = function() {
if(context[name] !== undefined) { if(context[name] !== undefined) {
return context[name]; return context[name];
} }
throw("Can't find " + name + " in " + context);
throw({message: "'" + name + "' not found in context"});
}, },


// Utility methods // Utility methods


+ 2
- 2
test/mustache_spec.rb Visa fil

@@ -34,10 +34,10 @@ 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);
print('ERROR: ' + e.message);
} }
JS JS
run_js(js).should == "ERROR: Can't find x in [object Object]\n"
run_js(js).should == "ERROR: 'x' not found in context\n"
end end
non_partials.each do |testname| non_partials.each do |testname|


Laddar…
Avbryt
Spara