lutaml / lutaml-uml

UML module for LutaML
2 stars 2 forks source link

When a syntax error is detected, show the actual line number containing the error #72

Closed ronaldtse closed 2 years ago

ronaldtse commented 3 years ago

On any syntax error, LutaML throws this error which is definitely not user-friendly. We should specify which exact line is causing the parsing error.

$ lutaml -t png -o images/StandardDoc_Terms.png views/StandardDoc_Terms.lutaml
Traceback (most recent call last):
    14: from /Users/me/.rbenv/versions/2.6.6/bin/lutaml:23:in `<main>'
    13: from /Users/me/.rbenv/versions/2.6.6/bin/lutaml:23:in `load'
    12: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/exe/lutaml:22:in `<top (required)>'
    11: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/command_line.rb:21:in `run'
    10: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/command_line.rb:83:in `run'
     9: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/command_line.rb:83:in `each'
     8: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/command_line.rb:90:in `block in run'
     7: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/parser.rb:18:in `parse_into_document'
     6: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/parser.rb:39:in `parse_into_document'
     5: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/parser.rb:39:in `map'
     4: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-0.4.1/lib/lutaml/parser.rb:39:in `block in parse_into_document'
     3: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.9/lib/lutaml/uml/parsers/dsl.rb:18:in `parse'
     2: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/lutaml-uml-0.2.9/lib/lutaml/uml/parsers/dsl.rb:23:in `parse'
     1: from /Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/parslet-1.7.1/lib/parslet/atoms/base.rb:49:in `parse'
/Users/me/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/parslet-1.7.1/lib/parslet/cause.rb:70:in `raise': Failed to match sequence (WHITESPACE? DIAGRAM_DEFINITION) at line 1 char 1. (Parslet::ParseFailed)
w00lf commented 3 years ago

@ronaldtse this one was addressed in https://github.com/lutaml/lutaml-uml/pull/89