Exception: Liquid::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/liquid/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#line_numberObject

Returns the value of attribute line_number



3
4
5
# File 'lib/liquid/errors.rb', line 3

def line_number
  @line_number
end

#markup_contextObject

Returns the value of attribute markup_context



4
5
6
# File 'lib/liquid/errors.rb', line 4

def markup_context
  @markup_context
end

Class Method Details

.render(e) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/liquid/errors.rb', line 25

def self.render(e)
  if e.is_a?(Liquid::Error)
    e.to_s
  else
    "Liquid error: #{e.to_s}"
  end
end

Instance Method Details

#set_line_number_from_token(token) ⇒ Object



19
20
21
22
23
# File 'lib/liquid/errors.rb', line 19

def set_line_number_from_token(token)
  return unless token.respond_to?(:line_number)
  return if self.line_number
  self.line_number = token.line_number
end

#to_s(with_prefix = true) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/liquid/errors.rb', line 6

def to_s(with_prefix=true)
  str = ""
  str << message_prefix if with_prefix
  str << super()

  if markup_context
    str << " "
    str << markup_context
  end

  str
end