Exception: Traceur::CompilationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/traceur/compilation_error.rb

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ CompilationError

Returns a new instance of CompilationError.



5
6
7
8
# File 'lib/traceur/compilation_error.rb', line 5

def initialize(errors)
  @errors = errors
  super(errors.map(&:to_s).join("\n"))
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/traceur/compilation_error.rb', line 3

def errors
  @errors
end

Class Method Details

.parse(error_string) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/traceur/compilation_error.rb', line 10

def self.parse(error_string)
  lines = error_string.split("\n")

  errors = lines.map do |line|
    file, line, column, message = line.split(':')
    Error.new(file.strip, line.to_i, column.to_i, message.strip)
  end

  new(errors)
end