Module: Mirah::Util::ProcessErrors

Included in:
Generator, Parser
Defined in:
lib/mirah/util/process_errors.rb

Instance Method Summary collapse

Instance Method Details

#process_errors(errors) ⇒ Object

errors - array of NodeErrors



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/mirah/util/process_errors.rb', line 20

def process_errors(errors)
  errors.each do |ex|
    puts ex
    if ex.node
      Mirah.print_error(ex.message, ex.position)
    else
      puts ex.message
    end
    if ex.kind_of?(Mirah::InternalCompilerError) && ex.cause
      puts ex.cause
      puts ex.cause.backtrace
    elsif @verbose
      puts ex.backtrace
    end
  end
  throw :exit, 1 unless errors.empty?
end