render! will properly force rethrow of errors if context is passed as an argument

This commit is contained in:
Thierry Joyal
2014-05-01 16:44:00 +00:00
parent 73098ac5bc
commit ad1152853a
5 changed files with 26 additions and 3 deletions
+2
View File
@@ -15,6 +15,8 @@ module Liquid
class Context
attr_reader :scopes, :errors, :registers, :environments, :resource_limits
attr_accessor :rethrow_errors
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = {})
@environments = [environments].flatten
@scopes = [(outer_scope || {})]
+5 -2
View File
@@ -113,7 +113,9 @@ module Liquid
context = case args.first
when Liquid::Context
args.shift
c = args.shift
c.rethrow_errors = true if @rethrow_errors
c
when Liquid::Drop
drop = args.shift
drop.context = Context.new([drop, assigns], instance_assigns, registers, @rethrow_errors, @resource_limits)
@@ -156,7 +158,8 @@ module Liquid
end
def render!(*args)
@rethrow_errors = true; render(*args)
@rethrow_errors = true
render(*args)
end
private