summaryrefslogtreecommitdiff
path: root/qface
diff options
context:
space:
mode:
Diffstat (limited to 'qface')
-rw-r--r--qface/generator.py17
-rw-r--r--qface/idl/domain.py6
2 files changed, 16 insertions, 7 deletions
diff --git a/qface/generator.py b/qface/generator.py
index d84a04c..297c2ef 100644
--- a/qface/generator.py
+++ b/qface/generator.py
@@ -345,10 +345,15 @@ class FileSystem(object):
return
meta = FileSystem.load_yaml(document)
click.secho('merge: {0}'.format(document.name), fg='blue')
- for identifier, data in meta.items():
- symbol = system.lookup(identifier)
- if symbol:
- merge(symbol.tags, data)
+ try:
+ for identifier, data in meta.items():
+ symbol = system.lookup(identifier)
+ if symbol:
+ merge(symbol.tags, data)
+ except Exception as e:
+ click.secho('Error parsing annotation {0}: {1}'.format(document, e), fg='red', err=True)
+ if FileSystem.strict:
+ sys.exit(-1)
@staticmethod
def parse(input, identifier: str = None, use_cache=False, clear_cache=True, pattern="*.qface", profile=EProfile.FULL):
@@ -391,6 +396,8 @@ class FileSystem(object):
if not document.exists():
if required:
click.secho('yaml document does not exists: {0}'.format(document), fg='red', err=True)
+ if FileSystem.strict:
+ sys.exit(-1)
return {}
try:
return yaml.load(document.text(), Loader=Loader)
@@ -399,4 +406,6 @@ class FileSystem(object):
if hasattr(exc, 'problem_mark'):
error = '{0}:{1}'.format(error, exc.problem_mark.line+1)
click.secho('{0}: error: {1}'.format(error, str(exc)), fg='red', err=True)
+ if FileSystem.strict:
+ sys.exit(-1)
return {}
diff --git a/qface/idl/domain.py b/qface/idl/domain.py
index 7949e6c..fbd0175 100644
--- a/qface/idl/domain.py
+++ b/qface/idl/domain.py
@@ -55,10 +55,10 @@ class System(object):
return self._moduleMap[name]
# <module>.<Symbol>
(module_name, type_name, fragment_name) = self.split_typename(name)
- if not module_name and type_name:
- click.secho('not able to lookup symbol: {0}'.format(name), fg='red')
- return None
+ if not module_name in self._moduleMap:
+ raise Exception('not able to lookup symbol: {0}'.format(name))
module = self._moduleMap[module_name]
+ # The module lookup calls this function again if the type_name doesn't exist
return module.lookup(type_name, fragment_name)
@staticmethod