mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
feature: Allow a default exception renderer to be specified (#837)
This could be used to preserve the old default of rendering non-Liquid::Error messages or for providing default behaviour like error reporting which could be missed if the exception renderer needed to be specified on each render.
This commit is contained in:
committed by
GitHub
parent
fae3a2de7b
commit
869dbc7ebf
@@ -27,6 +27,7 @@ module Liquid
|
||||
|
||||
@this_stack_used = false
|
||||
|
||||
self.exception_renderer = Template.default_exception_renderer
|
||||
if rethrow_errors
|
||||
self.exception_renderer = ->(e) { raise }
|
||||
end
|
||||
@@ -78,9 +79,7 @@ module Liquid
|
||||
e.template_name ||= template_name
|
||||
e.line_number ||= line_number
|
||||
errors.push(e)
|
||||
|
||||
e = exception_renderer.call(e) if exception_renderer
|
||||
e.to_s
|
||||
exception_renderer.call(e).to_s
|
||||
end
|
||||
|
||||
def invoke(method, *args)
|
||||
|
||||
Reference in New Issue
Block a user