Sha256: d43d81d31e2b2ac67ae2cea4a539af3beaf9595eb0dfe1a9e97c710384670c16

Contents?: true

Size: 654 Bytes

Versions: 1

Compression:

Stored size: 654 Bytes

Contents

class RenderMePretty::Erb
  class MainErrorHandler < BaseHandler
    def handle
      line_number = find_line_number
      pretty_trace(line_number, full_message=true) # returns StringIO
    end

    # 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?(@path)
      end.first
      error_line.split(':')[1].to_i
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
render_me_pretty-0.6.0 lib/render_me_pretty/erb/main_error_handler.rb