Exception: Locomotive::Common::RendererException

Inherits:
DefaultException show all
Defined in:
lib/locomotive/common/exception.rb

Instance Attribute Summary collapse

Attributes inherited from DefaultException

#notifier

Instance Method Summary collapse

Methods inherited from DefaultException

#init_plugins

Constructor Details

#initialize(exception, name, template, liquid_context) ⇒ RendererException

Returns a new instance of RendererException.



37
38
39
40
41
42
43
44
# File 'lib/locomotive/common/exception.rb', line 37

def initialize(exception, name, template, liquid_context)
  self.name = name
  self.template = template
  self.liquid_context = liquid_context
  log_page_into_backtrace(exception)
  super(exception.message)
  set_backtrace(exception.backtrace)
end

Instance Attribute Details

#liquid_contextObject

Returns the value of attribute liquid_context.



35
36
37
# File 'lib/locomotive/common/exception.rb', line 35

def liquid_context
  @liquid_context
end

#nameObject

Returns the value of attribute name.



35
36
37
# File 'lib/locomotive/common/exception.rb', line 35

def name
  @name
end

#templateObject

Returns the value of attribute template.



35
36
37
# File 'lib/locomotive/common/exception.rb', line 35

def template
  @template
end

Instance Method Details

#log_page_into_backtrace(exception) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/locomotive/common/exception.rb', line 46

def log_page_into_backtrace(exception)
  line = template.line_offset
  line += (exception.respond_to?(:line) ? exception.line || 0 : 0) + 1
  message = "#{template.filepath}:#{line}:in `#{name}'"
  notifier.fatal "[ERROR] #{exception.message} - #{message}\n".red
  exception.backtrace.unshift message
end