Include template name with line numbers in render errors.

This commit is contained in:
Dylan Thacker-Smith
2015-06-04 13:44:01 -04:00
parent c82e04f4e6
commit ad3748af21
4 changed files with 45 additions and 16 deletions
+2 -1
View File
@@ -13,7 +13,7 @@ module Liquid
# context['bob'] #=> nil class Context
class Context
attr_reader :scopes, :errors, :registers, :environments, :resource_limits
attr_accessor :exception_handler
attr_accessor :exception_handler, :template_name
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil)
@environments = [environments].flatten
@@ -64,6 +64,7 @@ module Liquid
def handle_error(e, token = nil)
if e.is_a?(Liquid::Error)
e.template_name = template_name
e.set_line_number_from_token(token)
end