Throw when trying to overwrite a template context value. Fixes #1884
This commit is contained in:
parent
09a7d89fd3
commit
7e3baed196
1 changed files with 7 additions and 7 deletions
|
@ -36,14 +36,14 @@ module Middleman
|
|||
@opts = opts
|
||||
|
||||
@locs.each do |k, _|
|
||||
if self.respond_to?(k)
|
||||
msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
|
||||
next unless self.respond_to?(k)
|
||||
|
||||
if app.build?
|
||||
throw msg
|
||||
else
|
||||
logger.error(msg)
|
||||
end
|
||||
msg = "Template local `#{k}` tried to overwrite an existing context value. Please renamed the key when passing to `locals`"
|
||||
|
||||
if app.build?
|
||||
throw msg
|
||||
else
|
||||
logger.error(msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue