Skip to content

Commit

Permalink
Reported the location of yaml parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemerle committed Apr 28, 2022
1 parent 421bb09 commit c926549
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/cloudnet/tosca/tosca2cloudnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from cloudnet.tosca.tosca_diagrams import ToscaDiagramGenerator
from cloudnet.tosca.type_system import TypeChecker, TypeSystem
from cloudnet.tosca.uml2_diagrams import PlantUMLGenerator
from .yaml_line_numbering import Coord

ALIASED_TOSCA_SERVICE_TEMPLATES = "aliased_tosca_service_templates"

Expand Down Expand Up @@ -110,10 +111,16 @@ def main(argv):
args.template_file, config.get(ALIASED_TOSCA_SERVICE_TEMPLATES)
)
except Exception as e:
location = ""
if len(e.args) != 0:
arg = e.args[0]
if isinstance(arg, Coord):
location = "@%d,%d" % (arg.line, arg.column)
print(
processors.CRED,
"[ERROR] ",
args.template_file,
location,
": ",
e,
processors.CEND,
Expand Down

0 comments on commit c926549

Please sign in to comment.