Exception: SassC::SyntaxError

Inherits:
BaseError
  • Object
show all
Defined in:
lib/sassc/error.rb

Overview

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.

Instance Method Summary collapse

Constructor Details

#initialize(message, filename: nil, line: nil) ⇒ SyntaxError

Returns a new instance of SyntaxError.


18
19
20
21
22
# File 'lib/sassc/error.rb', line 18

def initialize(message, filename: nil, line: nil)
  @filename = filename
  @line = line
  super(message)
end

Instance Method Details

#backtraceObject


24
25
26
27
# File 'lib/sassc/error.rb', line 24

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

#sass_backtraceObject

The backtrace of the error within Sass files.


30
31
32
33
# File 'lib/sassc/error.rb', line 30

def sass_backtrace
  return [] unless @filename && @line
  ["#{@filename}:#{@line}"]
end