Просмотр исходного кода

Fix error message consistency.

tags/0.2
Paul J. Davis 16 лет назад
Родитель
Сommit
895e741234
5 измененных файлов: 6 добавлений и 3 удалений
  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 Просмотреть файл

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

+ 1
- 0
examples/error_not_found.js Просмотреть файл

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

+ 1
- 0
examples/error_not_found.txt Просмотреть файл

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

+ 1
- 1
mustache.js Просмотреть файл

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

// Utility methods


+ 2
- 2
test/mustache_spec.rb Просмотреть файл

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


Загрузка…
Отмена
Сохранить