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:
parent
ee3d8d2f18
commit
aa020af040
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user