123456789_123456789_123456789_123456789_123456789_

Exception: ActionView::SyntaxErrorInTemplate

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, StandardError
Instance Chain:
self, StandardError
Inherits: ActionView::Template::Error
  • ::Object
Defined in: actionview/lib/action_view/template/error.rb

Overview

:nodoc

Class Method Summary

Instance Method Summary

Constructor Details

.new(template, offending_code_string) ⇒ SyntaxErrorInTemplate

[ GitHub ]

  
# File 'actionview/lib/action_view/template/error.rb', line 138

def initialize(template, offending_code_string)
  @offending_code_string = offending_code_string
  super(template)
end

Instance Method Details

#annotated_source_code

[ GitHub ]

  
# File 'actionview/lib/action_view/template/error.rb', line 149

def annotated_source_code
  @offending_code_string.split("\n").map.with_index(1) { |line, index|
    indentation = " " * 4
    "#{index}:#{indentation}#{line}"
  }
end

#message

[ GitHub ]

  
# File 'actionview/lib/action_view/template/error.rb', line 143

def message
  <<~MESSAGE
    Encountered a syntax error while rendering template: check #{@offending_code_string}
  MESSAGE
end