diff options
author | Yehuda Katz <wycats@gmail.com> | 2012-12-23 20:15:18 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2012-12-23 20:15:18 -0800 |
commit | 9385666e08ed86ddb10095ccfef9fa731adae16e (patch) | |
tree | dce14999d1cf52f2e8499560a846eb6cd721afa6 /lib/handlebars/compiler/compiler.js | |
parent | 19bfbe07f8d4fd6f66dea29c806024304ce367af (diff) | |
download | handlebars.js-9385666e08ed86ddb10095ccfef9fa731adae16e.zip handlebars.js-9385666e08ed86ddb10095ccfef9fa731adae16e.tar.gz handlebars.js-9385666e08ed86ddb10095ccfef9fa731adae16e.tar.bz2 |
Get a better error for compile(falsy)
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 7578dd2..1481098 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -1035,6 +1035,10 @@ Handlebars.JavaScriptCompiler = function() {}; })(Handlebars.Compiler, Handlebars.JavaScriptCompiler); Handlebars.precompile = function(string, options) { + if (typeof string !== 'string') { + throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string); + } + options = options || {}; var ast = Handlebars.parse(string); @@ -1043,6 +1047,10 @@ Handlebars.precompile = function(string, options) { }; Handlebars.compile = function(string, options) { + if (typeof string !== 'string') { + throw new Handlebars.Exception("You must pass a string to Handlebars.compile. You passed " + string); + } + options = options || {}; var compiled; |