1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-05 06:50:10 +01:00

srclibs: forward yml parsing error cause

This commit is contained in:
Michael Pöhn 2019-12-24 08:35:27 +01:00
parent ee3d8d2f18
commit aa020af040

View File

@ -42,12 +42,15 @@ srclibs = None
warnings_action = None
def warn_or_exception(value):
def warn_or_exception(value, cause=None):
'''output warning or Exception depending on -W'''
if warnings_action == 'ignore':
pass
elif warnings_action == 'error':
raise MetaDataException(value)
if cause:
raise MetaDataException(value) from cause
else:
raise MetaDataException(value)
else:
logging.warning(value)
@ -763,14 +766,15 @@ def parse_yml_srclib(metadatapath):
except yaml.error.YAMLError as e:
warn_or_exception(_("Invalid srclib metadata: could not "
"parse '{file}'"
.format(file=metadatapath)))
.format(file=metadatapath)),
e)
return thisinfo
for key in data.keys():
if key not in thisinfo.keys():
warn_or_exception(_("Invalid srclib metadata: unknown key "
"'{key}' in '{file}'")
.format(key=key, file=metadatapath))
.format(key=key, file=metadatapath))
return thisinfo
else:
if key == 'Subdir':