diff --git a/lib/liquid.rb b/lib/liquid.rb index e10cdf6..2833794 100644 --- a/lib/liquid.rb +++ b/lib/liquid.rb @@ -42,6 +42,8 @@ module Liquid TemplateParser = /(#{PartialTemplateParser}|#{AnyStartingTag})/om VariableParser = /\[[^\]]+\]|#{VariableSegment}+\??/o + RAISE_EXCEPTION_LAMBDA = ->(_e) { raise } + singleton_class.send(:attr_accessor, :cache_classes) self.cache_classes = true end diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 9cd869d..29fa196 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -41,7 +41,7 @@ module Liquid self.exception_renderer = Template.default_exception_renderer if rethrow_errors - self.exception_renderer = ->(_e) { raise } + self.exception_renderer = Liquid::RAISE_EXCEPTION_LAMBDA end # Do this last, since it could result in this object being passed to a Proc in the environment diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index 56c25d8..3009c39 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -153,7 +153,7 @@ module Liquid c = args.shift if @rethrow_errors - c.exception_renderer = ->(_e) { raise } + c.exception_renderer = Liquid::RAISE_EXCEPTION_LAMBDA end c