From c926549d1363e9978b6d664f70263cb35ad9f06d Mon Sep 17 00:00:00 2001 From: Philippe Merle Date: Thu, 28 Apr 2022 13:23:49 +0200 Subject: [PATCH] Reported the location of yaml parsing errors --- bin/cloudnet/tosca/tosca2cloudnet.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/cloudnet/tosca/tosca2cloudnet.py b/bin/cloudnet/tosca/tosca2cloudnet.py index 2d7bb40..df9e99a 100644 --- a/bin/cloudnet/tosca/tosca2cloudnet.py +++ b/bin/cloudnet/tosca/tosca2cloudnet.py @@ -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" @@ -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,