Sha256: 915089cbe0ada386a7bedcee22ddab69686e6c94705ae9146f26830822fd0538

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 Bytes

Contents

class RenderMePretty::Erb
  class MainErrorHandler < BaseHandler
    # For general Tilt errors first line of the backtrace that contains the path
    # of the file we're rendeirng and has the line number. Example:
    #
    #   spec/fixtures/invalid.erb:2:in `block in singleton class'
    #   error_info = e.backtrace[0]
    def find_line_number
      lines = @exception.backtrace
      error_line = lines.select do |line|
        line.include?(template_path_with_error)
      end.first
      error_line.split(':')[1].to_i
    end

    def error_in_layout?
      # The first line of the backtrace has the template path that errored
      error_info = @exception.backtrace[0]
      error_info.include?(@layout_path) if @layout_path
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
render_me_pretty-0.8.2 lib/render_me_pretty/erb/main_error_handler.rb
render_me_pretty-0.8.1 lib/render_me_pretty/erb/main_error_handler.rb
render_me_pretty-0.8.0 lib/render_me_pretty/erb/main_error_handler.rb