Sha256: dd587cfd7fa866a4ddfd6983abec102a0ceff56b2de60110ad0a762f66d7bf05

Contents?: true

Size: 1.23 KB

Versions: 45

Compression:

Stored size: 1.23 KB

Contents

module Sass
  # Sass::SyntaxError encapsulates information about the exception,
  # such as the line of the Sass template it was raised on
  # and the Sass file that was being parsed (if applicable).
  # It also provides a handy way to rescue only exceptions raised
  # because of a faulty template.
  class SyntaxError < StandardError
    # The line of the Sass template on which the exception was thrown.
    attr_accessor :sass_line

    # The name of the file that was being parsed when the exception was raised.
    # This will be nil unless Sass is being used as an ActionView plugin.
    attr_reader :sass_filename

    # Creates a new SyntaxError.
    # +lineno+ should be the line of the Sass template on which the error occurred.
    def initialize(msg, lineno = nil)
      @message = msg
      @sass_line = lineno
    end

    # Adds a properly formatted entry to the exception's backtrace.
    # +filename+ should be the file in which the error occurred,
    # if applicable (defaults to "(sass)").
    def add_backtrace_entry(filename) # :nodoc:
      @sass_filename ||= filename
      self.backtrace ||= []
      self.backtrace.unshift "#{@sass_filename || '(sass)'}:#{@sass_line}"
    end

    def to_s # :nodoc:
      @message
    end
  end
end

Version data entries

45 entries across 45 versions & 11 rubygems

Version Path
honkster-haml-2.1.0 lib/sass/error.rb
honkster-haml-2.1.1 lib/sass/error.rb
jwhitmire-haml-2.1.0.1 lib/sass/error.rb
jwhitmire-haml-2.1.0.2 lib/sass/error.rb
jwhitmire-haml-2.1.0.3 lib/sass/error.rb
wireframe-haml-2.1.0 lib/sass/error.rb
wireframe-haml-2.1.1 lib/sass/error.rb
radiantcms-couchrest_model-0.2.4 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.2.2 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.2.1 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.2 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.1.9 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.1.8 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.1.7 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.1.6 vendor/plugins/haml/lib/sass/error.rb
radiantcms-couchrest_model-0.1.5 vendor/plugins/haml/lib/sass/error.rb
radiant-0.8.2 vendor/plugins/haml/lib/sass/error.rb
radiant-rc-0.9.0 vendor/plugins/haml/lib/sass/error.rb
radiant-0.8.1 vendor/plugins/haml/lib/sass/error.rb
haml-2.0.10 lib/sass/error.rb