Throw when trying to overwrite a template context value. Fixes #1884

This commit is contained in:
Thomas Reynolds 2016-04-19 10:37:23 -07:00
parent 09a7d89fd3
commit 7e3baed196

View file

@ -36,14 +36,14 @@ module Middleman
@opts = opts @opts = opts
@locs.each do |k, _| @locs.each do |k, _|
if self.respond_to?(k) next unless self.respond_to?(k)
msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
if app.build? msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
throw msg
else if app.build?
logger.error(msg) throw msg
end else
logger.error(msg)
end end
end end
end end