mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
render! will properly force rethrow of errors if context is passed as an argument
This commit is contained in:
@@ -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 || {})]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user