Sha256: fe0d8ac12e9eb5ab7da756fb94b621c224fe6a550f7ae993226b5f3644beb3f5

Contents?: true

Size: 820 Bytes

Versions: 9

Compression:

Stored size: 820 Bytes

Contents

require 'pathname'
require 'sass/error'

module SassC
  class BaseError < StandardError; end
  class NotRenderedError < BaseError; end
  class InvalidStyleError < BaseError; end
  class UnsupportedValue < BaseError; end

  # When dealing with SyntaxErrors,
  # it's important to provide filename and line number information.
  # This will be used in various error reports to users, including backtraces;
  class SyntaxError < BaseError
    def initialize(message, filename: nil, line: nil)
      @filename = filename
      @line = line
      super(message)
    end

    def backtrace
      return nil if super.nil?
      sass_backtrace + super
    end

    # The backtrace of the error within Sass files.
    def sass_backtrace
      return [] unless @filename && @line
      ["#{@filename}:#{@line}"]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sassc-1.12.1 lib/sassc/error.rb
sassc-1.12.0 lib/sassc/error.rb
sassc-1.11.4 lib/sassc/error.rb
sassc-1.11.3 lib/sassc/error.rb
sassc-1.11.2 lib/sassc/error.rb
sassc-1.11.1 lib/sassc/error.rb
sassc-1.11.0 lib/sassc/error.rb
sassc-1.10.1 lib/sassc/error.rb
sassc-1.10.0 lib/sassc/error.rb