Module: Arrays::ErrorHandler

Included in:
ArrayAddTag, ArrayBlock, ArrayCreateTag, ArrayDeleteTag, ArrayInsertTag, ArrayReplaceTag, HashCreateTag, HashDeleteTag, HashSetTag
Defined in:
lib/liquid-arrays/error_handler.rb

Instance Method Summary collapse

Instance Method Details

#catchObject



15
16
17
18
19
20
21
# File 'lib/liquid-arrays/error_handler.rb', line 15

def catch
  begin
    yield
  rescue => e
    handle(e)
  end
end

#handle(error) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/liquid-arrays/error_handler.rb', line 3

def handle(error)
  error.line_number = line_number
  error.markup_context = "in \"#{@markup.strip}\""
  
  case @parse_context.error_mode
  when :strict
    raise error
  when :warn
    @parse_context.warnings << error
  end
end