Commit 020ad560 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Better handling of fatal parse errors.

In addition to stack trace the name of the file causing the problem is
printed.
parent d126cbb0
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -80,11 +80,19 @@ module JsDuck

    # Parses the file depending on filename as JS or CSS
    def parse
      begin
        if @filename =~ /\.s?css$/
          CssParser.new(@contents, @options).parse
        else
          JsParser.new(@contents, @options).parse
        end
      rescue
        puts "Error while parsing #{@filename}: #{$!}"
        puts
        puts "Here's a full backtrace:"
        puts $!.backtrace
        exit(1)
      end
    end

    # Creates two-way link between sourcefile and doc-object.