mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Resource limits: Don't raise Error but render error message (but abort after first error)
This commit is contained in:
+2
-2
@@ -108,9 +108,9 @@ module Liquid
|
||||
|
||||
token_output = (token.respond_to?(:render) ? token.render(context) : token)
|
||||
context.resource_limits[:render_length_current] += (token_output.respond_to?(:length) ? token_output.length : 1)
|
||||
raise Liquid::MemoryError, context.resource_limits if context.resource_limits_reached?
|
||||
raise MemoryError.new("Memory limits exceeded") if context.resource_limits_reached?
|
||||
output << token_output
|
||||
rescue Liquid::MemoryError => e
|
||||
rescue MemoryError => e
|
||||
raise e
|
||||
rescue ::StandardError => e
|
||||
output << (context.handle_error(e))
|
||||
|
||||
@@ -120,9 +120,11 @@ module Liquid
|
||||
|
||||
begin
|
||||
# render the nodelist.
|
||||
# for performance reasons we get a array back here. join will make a string out of it
|
||||
# for performance reasons we get an array back here. join will make a string out of it.
|
||||
result = @root.render(context)
|
||||
result.respond_to?(:join) ? result.join : result
|
||||
rescue Liquid::MemoryError => e
|
||||
context.handle_error(e)
|
||||
ensure
|
||||
@errors = context.errors
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user