Merge pull request #352 from gaiottino/master

Add error messages for missing variables when :strict

Conflicts:
	History.md
This commit is contained in:
Arthur Neves
2014-05-06 10:16:45 -04:00
3 changed files with 25 additions and 0 deletions
+6
View File
@@ -205,6 +205,7 @@ module Liquid
end
scope ||= @environments.last || @scopes.last
handle_not_found(key) unless scope.has_key?(key)
variable ||= lookup_and_evaluate(scope, key)
variable = variable.to_liquid
@@ -254,6 +255,7 @@ module Liquid
# No key was present with the desired value and it wasn't one of the directly supported
# keywords either. The only thing we got left is to return nil
else
handle_not_found(markup)
return nil
end
@@ -283,6 +285,10 @@ module Liquid
end
end
end # squash_instance_assigns_with_environments
def handle_not_found(variable)
@errors << "Variable {{#{variable}}} not found" if Template.error_mode == :strict
end
end # Context
end # Liquid